Remove specified character in a string

I need to remove from various strings when find the sequence " ,0 ".
Not only , or only 0. Only when is exactly ,0
Is it possible?

2 Likes

Try using the Replace node. Give ,0 as the From parameter and leave the To argument empty.
Like this:

7 Likes

Can’t tell you how to “remove” stuff since I don’t know exactly what you are removing but I can show you how to find a string with “,0” . See screen shot below. Hope it helps.

Didn’t even know about this…definitely much simpler than my idea! I would use this method, unless you have some need for extra code ha

Sorry but i have already tryed this but for some reason didn’t work, this delete another character dunno why.
My blueprint is getting 1 string plus 1 float combine them into string then replace ,0 but when use replace,in the string delete all character, and i see only 0 in screen.
(The code work perfectly without replace)

Thanks but the question is how to remove them, any idea?

Oh, my fault. I had placed the wrong replace, there are 2 replace, one return string and one return int. thank anyway guys

1 Like

Hi If your looking to remove a single Character instead of all instances of that character;
Create a function > use get characters array from string node & store the array as a local variable > Remove Index (E.G on for each loop etc.)> On Complete; Set Original string to null > Use Join string node and append to concatenate the array and your null string.

(Essentially you are creating an array, removing indexes, then re-combining the array)
In the image I am removing any found character from the input array from my local array. But only removing the first instance of each character found.

4 Likes

My Answer may be of use to you.

OMG Thank you so much for this I worked on this for hours with much more complicated code that half worked.