I have a string as follows:
var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f";
How do I remove the '=' character from this? I've tried a couple of different ways but the '=' character seems to be causing a conflict
I have a string as follows:
var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f";
How do I remove the '=' character from this? I've tried a couple of different ways but the '=' character seems to be causing a conflict
If it's always the first character then this will work...
var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f".substring(1);
If it's not definitely the first character then this will work...
var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f".replace("=", "");
If it's in there more than once then this will work...
var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f".split("=").join("");
You can use .replace():
The replace() method returns a new string with some or all matches of a pattern replaced by a replacement
string = string.replace('=','');
Its very simple.
var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f";
string=string.replace('=','');
Do this:
var string = "=09e8d76c-c54c-32e1-a98e-7e654d32ec1f";
if(string.indexOf('=')>=0){ //check string contains =
string = string.replace("=",'');
}