so output attributes csv, i'm using stringbuilder
uses commas natural delimiter commas. problem when add string commas inside in string, it's splitting separate columns me. ex
temp.append("ab,cd,ef")
giving me 3 separate columns. how output single column commas intact.
it's result of capture group
match = regex.match(amt, "^\"([\\d,]+),(\\d\\d\\d)\"$");
and did
amt = convert.tostring(match.groups[1].value) + convert.tostring(match.groups[2].value);
so takes in 123,123,123,123 unknown number of commas , want output exact same thing last commas replaced period. it's still coming out
123 123 123 123 123
in separate columns
you need wrap entry in quote
temp.append("\"ab,cd,ed\"");
updated after redited question
from saying wish convert 123,445,567,890
123,445,567.890
, want csv output work:
you still need wrap result in quotes need
amt = string.format("\"{0}.{1}\"", match.groups[1].value, match.groups[2].value);
alternatively replace last ','
amt = new regex(",(?=\\d{3}\"$)").replace(x,".");
or without regex.
char[] y = amt.tochararray(); y[amt.lastindexof(",")] = '.'; amt = string(y);
Comments
Post a Comment