System.String
Expose members that perform string tasks
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
namespace System public sealed class String
The String class exposes members that perform various tasks on strings, such as concatenating, comparing, replacing, and copying. The members documented below are available in traditional Synergy and Synergy .NET; for details about additional methods available in .NET, see Microsoft’s .NET documentation.
To initialize a new instance of String, use the syntax
string_var = "text"
All string comparison routines are case sensitive.
public enum StringSplitOptions None, 0 RemoveEmptyEntries, 1
Specifies whether the applicable Split method includes or omits empty array elements from the return value.
public Length
Returns the number of characters in the string. (int)
public Clone()
Returns a reference to this instance of String.
public static Concat(string1, string2), string
public static Concat(string1, string2, string3), string
public static Concat(string1, string2, string3, string4), string
Concatenates up to four strings and returns the resulting string.
or
public static Concat([#]string), string
Concatenates the elements of the specified string array and returns the resulting string.
For traditional Synergy, Concat(string1, string2, string3[, string4]) and Concat([#]string) are only available if the -qrntcompat compiler option is set to 11010100 or greater. You can turn this optimization off with -qnoopt.
public Contains(substring), boolean
Looks for a substring within a string. Returns true if substring occurs within the instance string (or if substring is an empty string); otherwise returns false.
public EndsWith(string), boolean
Determines if the end of a string matches a specified string. Returns true if the instance string ends with string; otherwise returns false.
public override Equals(object), boolean
Compares two strings and determines if they have the same value. Returns true if object (@*) is a string and its contents are the same as this instance; otherwise returns false.
public IndexOf(characters), int
Returns the 0-based index position of the first occurrence of the specified characters (alpha) in this string.
or
public IndexOf(string), int
Returns the 0-based index position of the first occurrence of the specified string in this instance.
or
public IndexOf(characters, startindex), int
Returns the 0-based index position of the first occurrence of a specified characters (alpha) in this string, beginning at startindex (int) and continuing to the end of the string.
or
public IndexOf(string, startindex), int
Returns the 0-based index position of the first occurrence of the specified string in this instance, beginning at startindex (int) and continuing to the end of the string.
or
public IndexOf(characters, startindex, count), int
Returns the 0-based index position of the first occurrence of the specified characters (alpha) in this instance, beginning at startindex (int) and continuing for count (int) number of character positions.
or
public IndexOf(string, startindex, count), int
Returns the 0-based index position of the first occurrence of the specified string in this instance, beginning at startindex (int) and continuing for count (int) number of character positions.
public Insert(startindex, string), string
Returns a new string in which the specified string is inserted at startindex (int).
public IsNullorEmpty(string), boolean
Returns whether the specified string is null or an empty string.
public IsNullorWhitespace(string), boolean
Returns whether the specified string is null, is an empty string, or contains only white-space characters.
public LastIndexOf(characters), int
Returns the 0-based index position of the last occurrence of the specified characters (alpha) in this instance.
or
public LastIndexOf(string), int
Returns the 0-based index position of the last occurrence of the specified string in this instance.
or
public LastIndexOf(characters, startindex), int
Returns the 0-based index position of the last occurrence of a specified characters (alpha) in this instance, beginning at startindex (int) and working backward toward the beginning of the string.
or
public LastIndexOf(string, startindex), int
Returns the 0-based index position of the last occurrence of the specified string in this instance, beginning at startindex (int) and working backward toward the beginning of the string.
or
public LastIndexOf(characters, startindex, count), int
Returns the 0-based index position of the specified characters (alpha) in a substring in this instance, beginning at startindex (int) and working backward toward the beginning of the string for count (int) number of character positions.
or
public LastIndexOf(string, startindex, count), int
Returns the 0-based index position of the last occurrence of the specified string in this instance, beginning at startindex (int) and working backward toward the beginning of the string for count (int) number of character positions.
public Remove(startindex), string
Returns a new string in which all characters in the current string beginning at startindex (int) and continuing through the end of the string are deleted.
or
public Remove(startindex, count), string
Returns a new string in which count (int) number of characters in the current string beginning at startindex (int) are deleted.
public Replace(oldstring, newstring), string
Returns a new string in which all occurrences of oldstring in the current instance are replaced with newstring. See Examples below.
public Split(characters), [#]string
Breaks a delimited string into substrings based on the characters (alpha) in an array.
or
public Split(characters, StringSplitOptions), [#]string
Breaks a delimited string into substrings based on the characters (alpha) in an array and specifies whether the substrings will include empty array elements.
or
public Split(string, StringSplitOptions), [#]string
Breaks a delimited string into substrings based on the strings in an array and specifies whether the substrings will include empty array elements.
See Examples below.
public StartsWith(string), boolean
Determines if the beginning of a string matches a specified string. Returns true if the instance string starts with string; otherwise returns false.
public Substring(startindex, length), string
Returns a substring from this instance that has the specified length (int) and begins at startindex (int).
public ToLower(), string
Returns a copy of the string in lowercase.
public override ToString(), string
Returns the value of this instance as a string.
public ToUpper(), string
Returns a copy of the string in uppercase.
public Trim(), string
Returns the current string object with all leading and trailing white-space characters removed.
or
public Trim(characters), string
Returns the current string object with all leading and trailing occurrences of a set of characters (alpha) removed.
public TrimEnd(characters), string
Removes all trailing occurrences of a set of characters (alpha) following the end of the current object.
public TrimStart(characters), string
Removes all leading occurrences of a set of characters (alpha) preceding the start of the current object.
The supported string operators are addition (+), equality (==), inequality (!=), and truth. See Object operators for more information. For example,
newstring = string + secondstring if stringvar == "ABC" if stringvar != "ABC" if stringvar
main record ;Declare a System.String variable mystring ,System.String endrecord proc ;Open channel to terminal open(1, O, "TT:") ;Populate the string variable mystring = "ABC" ;Write out the string variable writes(1, mystring) ;Use String class's Length property - one of the many string properties/methods writes(1, "The variable mystring has " + %string(mystring.length) + " characters") end
The example below illustrates the Replace method and results in mystring = “1,2,3,4”.
record mystring, @System.String proc mystring = "1 2 3 4" mystring = mystr.Replace(" ",",")
The example below illustrates the Split method and results in myarray having four elements, [0] 0, [1] 1, [2] 2, [3] 3. The number in the brackets is the index.
record
mystring, @System.String
myarray, [#]string
proc
mystring = "0,1,2,3"
myarray = mystring.Split(",",System.StringSplitOptions.None)