JBSoccerbrit
10 years agoContributor
Parsing a string and counting characters.
String Example: type1=12345678901234567890111&type2=3.0.00&type3=1234567811 From reading the user guide it looks like I can use the aqString.ListSeparator to define the & as use the delimiter and ...
- 10 years ago
Helen's reply got me thinking... Could we just use the powers of JavaScript directly?
function test() { var str = "type1=12345678901234567890111&type2=3.0.00&type3=1234567811"; var strarr = str.split('&'); for (var i = 0; i < strarr.length; i++) { var typearr = strarr[i].split('='); Log.Message(strarr[i]); switch (typearr[0]) { case 'type1': Log.Message("TYPE1: length = " + typearr[1].length); break; case 'type2': Log.Message("TYPE2: length = " + typearr[1].length); break; case 'type3': Log.Message("TYPE3: length = " + typearr[1].length); break; default: Log.Message("unrecognized type"); break; } } }
produces