LEFT$
<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > String functions > LEFT$ |
Description
Return the left-most n bytes of a string.
Syntax
s = LEFT$(StringExpression, nBytes)
Returns
String
Parameters
Name |
Type |
Optional |
Meaning |
StringExpression |
String |
No |
Original string from which portion will be extracted |
nBytes |
Numeric |
No |
Number of bytes to return |
Remarks
Restrictions
See also
String Handling, RIGHT$, MID$, LEFTW$
Examples
Thanks to Abraxas for the following script example
' Usage of the LEFT$ Keyword example
' Usage of the MID$ Keyword example
' Usage of the RIGHT$ Keyword example
Dim MyOLDString As String VALUE "HELLO WORLD"
Dim MyLEFTString As String
Dim MyMIDString As String
Dim MyRIGHTString As String
Dim sMsg As String
MyLEFTString = LEFT$ (MyOLDString, 4)
MyMIDString = MID$ (MyOLDString, 4, 2)
MyRIGHTString = RIGHT$(MyOLDString, 5)
sMsg += "Normal " & MyOLDString & $CRLF & $CRLF
sMsg += "LEFT$ " & MyLEFTString & $CRLF & $CRLF
sMsg += "MID$ " & MyMIDString & $CRLF & $CRLF
sMsg += "RIGHT$ " & MyRIGHTString & $CRLF & $CRLF
MSGBOX 0, sMsg