I have data like this, TITLE is the name of variable and below it is the string data (Please note the data can be different sometimes)
TITLE1
abcd
TITLE2
abcde
TITLE3
acd,sdssds!@#@$#$#%$%$^&**()aas
Now, I want to to send these three to java and want to make a linked map from them I did like this
JAVASCRIPT
var string = "TITLE1=abcd, TITLE2=abcde, TITLE3=acd,sdssds!@#@$#$#%$%$^&**()aas"
and used it in java as
JAVA
LinkedHashMap <String, String> selectedCheckBoxMap = new LinkedHashMap <String, String> ();
String[] pairs = selectedCheckBoxTokens.split (",");
for (int i = 0; i < pairs.length; i++)
{
String pair = pairs[i];
String[] keyValue = pair.split ("=");
selectedCheckBoxMap.put (keyValue[0], keyValue[1]);
}
But this breaks on "," as delimiter as TITLE3 already has character ','
I then used this character instead of "," as delimiter "‡", but this not a good approach.
What should I do ? Should I change it to hashmap in javascript ? But how to convert hashmap from javascript to JAVA directly ? Or should I use some other delimiter ?
The delimiter should be character that we cannot type or ever come across in text.
Thanks,
Aiden