Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference > Siebel VB Language Reference >
Left Function
This standard VB function returns a string of a specified length copied from the beginning of another string.
Syntax
Left[$]( string, length)
Argument Description string A string, or an expression containing a string, from which a portion is to be copied length An integer representing the number of characters to copy
Returns
A substring of string, of length length, beginning at the first character of string.
Usage
If length is greater than the length of string, Left returns the whole string.
Left accepts expressions of type string. Left accepts any type of string, including numeric values, and converts the input value to a string.
The dollar sign ($) in the function name is optional. If it is included, the return type is string. Otherwise the function returns a variant of vartype 8 (string). If the value of string is NULL, a variant of vartype 1 (Null) is returned.
Example
This example extracts a user's first name from the entire name entered.
Sub Button_Click
Dim username as String
Dim count as Integer
Dim firstname as String
Dim charspace
charspace = Chr(32)
username = "Chris Smith"
count = InStr(username,charspace)
firstname = Left(username,count)
End SubSee Also
Len Function
LTrim Function
Mid Function
Mid Statement
Right Function
RTrim Function
Str Function
StrComp Function
Trim Function
Bookshelf Home | Contents | Index | Search | PDF |
Siebel VB Language Reference Published: 18 June 2003 |