Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Strings StringParse  

StringParse

StringParse

Category: Strings
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for StringParse
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. StringParse_1.lsl
1 // From the book:
2 //
3 // Scripting Recipes for Second Life
4 // by Jeff Heaton (Encog Dod in SL)
5 // ISBN: 160439000
6 X// Copyright 2007 by Heaton Research, Inc.
7 //
8 // This script may be freely copied and modified so long as this header
9 // remains unmodified.
10 //
11 // For more information about this book visit the following web site:
12 //
13 // http://www.heatonresearch.com/articles/series/22/
14
15
16
17 string text;
18
19 string pop()
20 {
21 string result;
22 integer i = llSubStringIndex(text, " ");
23
24 if( i!=-1 )
25 {
26 i -=1;
27 result = llGetSubString(text,0,i);
28 text = llGetSubString(text,i+2,-1);
29 return result;
30 }
31 else
32 {
33 result = text;
34 text = "";
35 }
36
37 text = llStringTrim(text, STRING_TRIM);
38 result = llStringTrim(result, STRING_TRIM);
39
40 return result;
41 }
42
43
44
45 default
46 {
48 {
49 text = "Now is the time for all good men to come to the aid of their country.";
50 string str;
51
52 while( (str=pop())!="" )
53 {
54 llSay(0,str);
55 }
56 }
57 }

Back to the Best Free Tools in Second Life and OpenSim.