System.String

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
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 the .NET Framework documentation.

To initialize a new instance of String, use the syntax

string_var = "text"

All string comparison routines are case sensitive.

Enumerations

StringSplitOptions

public enum StringSplitOptions
    None,                 0
    RemoveEmptyEntries,   1

Specifies whether the applicable Split method includes or omits empty array elements from the return value.

Properties

Length

public Length

Returns the number of characters in the string. (int)

Methods

Clone

public Clone()

Returns a reference to this instance of String.

Concat

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.

Contains

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.

EndsWith

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.

Equals

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.

IndexOf

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.

Insert

public Insert(startindex, string), string

Returns a new string in which the specified string is inserted at startindex (int).

IsNullorEmpty

public IsNullorEmpty(string), boolean

Returns whether the specified string is null or an empty string.

IsNullorWhitespace

public IsNullorWhitespace(string), boolean

Returns whether the specified string is null, is an empty string, or contains only white-space characters.

LastIndexOf

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.

Remove

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.

Replace

public Replace(oldstring, newstring), string

Returns a new string in which all occurrences of oldstring in the current instance are replaced with newstring.

Split

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.

StartsWith

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.

Substring

public Substring(startindex, length), string

Returns a substring from this instance that has the specified length (int) and begins at startindex (int).

ToLower

public ToLower(), string

Returns a copy of the string in lowercase.

ToString

public override ToString(), string

Returns the value of this instance as a string.

ToUpper

public ToUpper(), string

Returns a copy of the string in uppercase.

Trim

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.

TrimEnd

public TrimEnd(characters), string

Removes all trailing occurrences of a set of characters (alpha) following the end of the current object.

TrimStart

public TrimStart(characters), string

Removes all leading occurrences of a set of characters (alpha) preceding the start of the current object.

Operators

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