SubStr3 Function | |
Extract a substring from a string, using strong typing and three required arguments.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION SubStr3(
cTarget AS STRING,
dwStart AS DWORD,
dwLen AS DWORD
) AS STRING
public static string SubStr3(
string cTarget,
uint dwStart,
uint dwLen
)
Request Example
View SourceParameters
- cTarget
- Type: String
The string from which to extract a substring. - dwStart
- Type: DWord
The starting position in cTarget. Since this argument is a WORD, it cannot be negative.
- dwLen
- Type: DWord
The number of characters to extract.
If omitted, the substring begins at dwStart and continues to the end of the string.
If dwLen is greater than the number of characters from dwStart to the end of cTarget, the extra is ignored.
Return Value
Type:
String
The substring.
If the substring is not found, it returns a NULL_STRING.
Remarks
Substr3() is a typed version of Substr() and requires three arguments. See Substr() for details.
Examples
These examples extract the first and last name from a variable:
1LOCAL cName AS STRING
2cName := "Biff Styvesent"
3? Substr3(cName, 1, 4)
4? Substr3(cName, 6, 9)
5? Substr3(cName, 6, 3)
6? Substr3(cName, SLen(cName) + 2, 5)
See Also