Extract a substring beginning with the first character in a string.
XSharp.Core (in XSharp.Core.dll) Version: 2.7
Syntax Request Example
cString AS STRING,
dwCount AS DWORD
) AS STRING
public static string Left(
- Type: String
The string from which to extract characters.
- Type: UInt32
The number of characters to extract.
The leftmost <dwCount> characters of <cString>.
If <dwCount> is negative or 0, Left() returns a NULL_STRING.
If <dwCount> is larger than the length of the string, Left() returns the entire string.
Left() is the same as Substr(<cString>, 1, <wCount>).
Left(), Right(), and Substr() are often used with both the At() and RAt() functions to locate the first and/or the last position of a substring before extracting it.
This example extracts the first three characters from the left of the target string:
This example extracts a substring from the beginning of a string up to the first occurrence of a comma:
1LOCAL cName := "James, William" AS STRING
2? LEFT(cName, AT(",", cName))