December 3, 2013

Sanitizing Your Strings

Do you have systems that insist on giving you numeric strings with embedded commas, currency symbols, hash marks, and spaces?

data = $12,340.14
data = 0.000 000 013 456
data = #336#

Use this method to concisely remove these annoyances from strings: 

  string text = "whateverAboveMessTheyGaveYou";
  float value = (float) llDumpList2String( 
         llParseString2List(text,["$",",","#"," "],[]),
         "");

[end]