I have a variable in my script containing data test/test1. The part test/ is already stored in another variable. I want to remove test/ from the previous variable and want to store remaining part in another variable. how can I do this??
Thanks in advance…:)
blasteralfred
In your case,
x/y:var success = myString.split('/')[1]You split the string by /, giving you
['x', 'y']. Then, you only need to target the second element (zero-indexed of course.)Edit: For a more general case, “notWantedwanted”:
Where notWantedString is equal to what you want to get rid of; in this particular case, “notWanted”.