Difference between revisions of "Left"
Jump to navigation
Jump to search
(New page: {{LSL Header}} __NOTOC__ <div id="box"> == Function: string left(float {{LSL Param|num}}, integer {{LSL Param|places}} , string {{LSL Param|rnd}}); == <div style="padding: ...) |
|||
Line 1: | Line 1: | ||
{{LSL Header}} __NOTOC__ | {{LSL Header}} __NOTOC__ | ||
<div id="box"> | <div id="box"> | ||
== Function: [[string]] left([[ | == Function: [[string]] left([[string]] {{LSL Param|src}}, [[string]] {{LSL Param|divider}}); == | ||
<div style="padding: 0.5em;"> | <div style="padding: 0.5em;"> | ||
Returns text left of a specified separator | Returns text left of a specified separator | ||
Line 25: | Line 25: | ||
</lsl> | </lsl> | ||
</div></div> | </div></div> | ||
{{LSLC|Examples|left}} | {{LSLC|Examples|left}} |
Revision as of 08:54, 13 July 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Function: string left(string src, string divider);
Returns text left of a specified separator
See also: Right
Example:
string notecardparameter = left(sdata,"="); //in a notecard line that reads Colour=Brown, returns "Colour="
Specification
<lsl> string left (string src, string divider) {
integer iStart = llSubStringIndex( src, divider ) + 1; string result = llGetSubString( src, 0, iStart -1) ;//note -2 here if you don't want the divider included in what you get back return result;
} </lsl>