Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string Text;
- string Value;
- //
- // parse a string and get the text and integer from it.
- // only works for one word and one integer.
- // yes this works 10, 10yes, 10Yes 10.99yes it does work
- // yes10no1 doesn't work
- // cast Value to integer or float as needed.
- //
- parseInput(string input)
- {
- integer index;
- while (index<llStringLength(input)){
- string character= llGetSubString(input,index,index);
- if((integer)character || llSubStringIndex("0.",character)>-1){
- Value+= character;
- } else{
- Text+=character;
- }
- index++;
- }
- }
- default
- {
- touch_start(integer total_number)
- {
- string input = "yes this works10.99";
- Text="";
- Value="";
- parseInput(input);
- llOwnerSay("text " + Text + " - value " + Value);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement