TrimList

From Second Life Wiki
Revision as of 18:59, 20 October 2011 by Ugleh Ulrik (talk | contribs) (Created page with "this function will trim a list of strings for the output of a dialog box. '''Function''' <lsl> list TrimList(list dlist, integer length) { integer i; list temp = []; …")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

this function will trim a list of strings for the output of a dialog box.

Function <lsl> list TrimList(list dlist, integer length) {

   integer i;
   list temp = [];
   for(i=0;i<llGetListLength(dlist);i++)
   {
       string text = llList2String(dlist,i);
       if (length < llStringLength(text))
       {
           length = length-1;
           string newstring = llGetSubString(text,0, length);
           temp += newstring;
       }
       else
       {
           temp += text;
       }
   }
   return temp;

}

</lsl>