Difference between revisions of "Left"
Jump to navigation
Jump to search
m |
|||
Line 16: | Line 16: | ||
integer index = llSubStringIndex( src, divider ); | integer index = llSubStringIndex( src, divider ); | ||
if(~index) | if(~index) | ||
return llDeleteSubString( src, index | return llDeleteSubString( src, index, -1); | ||
return src; | return src; | ||
}</lsl> | }</lsl> |
Revision as of 06:32, 4 April 2009
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: string left( string src, string divider );
Returns text left of a specified separator
Returns a string that is the text in src that is left of the first occurrence of divider.
• string | src | |||
• string | divider |
If divider is not found then src is returned in it's entirety.
See also: Right
Specification
<lsl>string left(string src, string divider) {
integer index = llSubStringIndex( src, divider ); if(~index) return llDeleteSubString( src, index, -1); return src;
}</lsl>
Examples
<lsl>string value = left("Colour=Brown", "="); //value == "Colour"</lsl>