Left: Difference between revisions
Jump to navigation
Jump to search
Add javascript snippet |
|||
Line 22: | Line 22: | ||
<pre> | <pre> | ||
// Left Example | // Left Example | ||
/*Left returns substring from string left end */ | /* Left returns substring from string left end */ | ||
var Wendy, Eric; | var Wendy, Eric; |
Revision as of 21:01, 19 May 2013
Left(string, length)
Description
Left returns a string containing a specified number of characters from the left end of a string. The required parameter, string, is any valid string expression. The required parameter, length, is any valid numeric expression, if length is 0, an empty string ("") is returned, if length is greater than the size of string, the entire string is returned.
Example (Basic)
Rem Left Example 'Left returns substring from string left end Dim Wendy, Eric Wendy = "Testaburger" Eric = "Cartman" Print "The Left 4 of " & Wendy & ": " _ & Left(Wendy, 4) Print "The Left 4 of " & Eric & ": " _ & Left(Eric, 4)
Example (JavaScript)
// Left Example /* Left returns substring from string left end */ var Wendy, Eric; Wendy = "Testaburger"; Eric = "Cartman"; NSB.Print("The Left 4 of " + Wendy + ": " + Wendy.substring(0,4) + "<br>"); NSB.Print("The Left 4 of " + Eric + ": " + Eric.substring(0,4) + "<br>");
Output
The Left 4 of Testaburger: Test The Left 4 of Cartman: Cart