Remove Comma from Text

I would like to remove the comma from NAME (text value) because it is taking up two columns in the cvs file.

I'm currently using the following script to remove the comma from the PRICE (number value) but do not know how to apply it to text values.

//Remove comma from PRICE and GLA
String [] variables = {"PRICE"};

i = 0;

// Iterate through each variable in the array above
while (i < variables.length){

//Get the variables to be fixed
value = session.getVariable(variables[i]);

//Log the UNFIXED values
session.log("UNFIXED: " + variables[i] + " = " + value);

if(value != null){
//Remove non-numerical elements from number
value = value.replaceAll("\\D","");

// Set variables with new values
dataRecord.put(variables[i], value);
session.setVariable(variables[i], value);

//Log the FIXED values
session.log("FIXED " + variables[i] + " = " + session.getVariable(variables[i]));
}
i++;
}

Thanks again for you help.

The simplest way to remove

The simplest way to remove something is to use java's "replaceAll" method. In the script you've been looking at, it is used on the line that says:

value = value.replaceAll("\\D", "");

You're allowed to use "regular expressions" to do complicated matching (the "\\D" means "\D" in 'regex' language, and that in turn means "anything that isn't a digit")

In your case, you can simplify it a lot:

name = name.replaceAll(",", "");

This will replace "," with "" (nothing), hence removing the commas.