Left Function | |
Extract a substring beginning with the first character in a string.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax FUNCTION Left(
cString AS STRING,
dwCount AS DWORD
) AS STRING
public static string Left(
string cString,
uint dwCount
)
Request Example
View SourceParameters
- cString
- Type: String
The string from which to extract characters. - dwCount
- Type: DWord
The number of characters to extract.
Return Value
Type:
String
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.
Remarks
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.
Examples
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))
See Also