# Trying to replace a comma

#1

Hi all -
I have a string:
Item 1, Item 2

using .replace(LVAR1,"")
LVAR 1 = Item

Im trying to replace Item 1

Item 1 is set by a click and i add the comma using on the click. how would i go about removing " ," to LVAR 1 with replace to remove the entire string?

Thanks!

#2

Hi!

I’m not sure I’m reading this right. Are you just trying to remove the comma?

If so, you’d do this, assuming LVAR has the text string:

``````LVAR.replace("," , "")
``````

There are two parameters to .replace(): the string you want to replace (here the comma within LVAR), and the string you want replace it with (here a blank string).

#3

Close - in the attached image, case 1 takes adds text. So Item 1 becomes item 1, item 2

Im trying to remove “, item2”

thanks again joseph