History |
Left (strings)
Purpose
Returns a string containing the leftmost characters of a string argument.
Syntax
Left (StringExpression, NumericExpression)
Example
Sub Main()
Dim s As String, Ioc As Integer
s = "the quick fox jumps over the dog"
Ioc = InStr(s, " ") 'find the first occurrence of a space character
If Ioc<>0 Then
Print "The first word in the sentence is:"; Left(s, Ioc - 1)
Print "The rest of the sentence is:"; Right(s, Len(s) - Ioc)
Else
print "Invalid sentence (no spaces)."
End If
End Sub
| ||||||