Difference between revisions of "$left"
From Scriptwiki
m |
|||
Line 5: | Line 5: | ||
$left(girlfriend.jpg, 10) returns girlfriend, the first ten characters from the beginning. | $left(girlfriend.jpg, 10) returns girlfriend, the first ten characters from the beginning. | ||
− | By giving N a negative value you get all | + | By giving N a negative value you get all except N characters. |
$left(girlfriend.jpg, -4) returns the same value. | $left(girlfriend.jpg, -4) returns the same value. | ||
Revision as of 14:37, 24 August 2005
Returns the N left characters of text.
$left(text,N)
$left(girlfriend.jpg, 10) returns girlfriend, the first ten characters from the beginning.
By giving N a negative value you get all except N characters. $left(girlfriend.jpg, -4) returns the same value.
Examples
$left and other idenfiers
What about if you don't know users gender, is it going to be she or he, boyfriend.jpg or girlfriend.jpg We can use
$left(girlfriend, $pos(girlfriend.jpg, ., 1))
to get the same result.
$left and aliases
var %c = 1, %str = cawabunga while (%c <= $len(%str)) { echo -a $left(%str, %c) inc %c }
Prints:
c ca caw cawa cawab cawabu cawabun cawabung cawabunga