Difference between revisions of "LlStringLength"

From Second Life Wiki
Jump to navigation Jump to search
m
m (cleaning up the style and optimizing just a bit, the C style of variable declaration is a bad practice in LSL.)
Line 9: Line 9:
|constants
|constants
|examples=<pre>
|examples=<pre>
default {
// assumptions:  
// assumptions:  
//       object name: LSLWiki
//   object name: LSLWiki
//       script name: _lslwiki
//   script name: _lslwiki
      state_entry() {
 
        integer i;
default
{
    state_entry()
    {
         string HowLongAmI = "123";
         string HowLongAmI = "123";
         i = llStringLength(HowLongAmI);
         integer strlen = llStringLength(HowLongAmI);
         llOwnerSay( HowLongAmI + " has " +(string) i + " characters."); //Edited by Liny Odell because it was missing a + and would have otherwise made a syntax error.
         llOwnerSay( "'" + HowLongAmI + "' has " +(string) strlen + " characters.");
      // The owner of object LSLWiki will hear  
        // The owner of object LSLWiki will hear  
      // LSLWiki: 123 has 3 characters.
        // LSLWiki: '123' has 3 characters.
      }
    }
}
}
</pre>
</pre>

Revision as of 15:48, 4 August 2007

Summary

Function: integer llStringLength( string str );

Returns an integer that is the number of characters in str (not counting the null).

• string str

Examples

// assumptions: 
//    object name: LSLWiki
//    script name: _lslwiki

default
{
    state_entry()
    {
        string HowLongAmI = "123";
        integer strlen = llStringLength(HowLongAmI);
        llOwnerSay( "'" + HowLongAmI + "' has " +(string) strlen + " characters.");
        // The owner of object LSLWiki will hear 
        // LSLWiki: '123' has 3 characters.
    }
}

See Also

Functions

•  llGetListLength

Deep Notes

Search JIRA for related Issues

Signature

function integer llStringLength( string str );