Replace specific word

Hello everyone,

I have the word “SUM_W31” and I want to replace just the “SUM_W”, that in the end, I only have “31” in my cell.
I think I have to split the string but I’m not sure… And it’s not always “31”, so I can’t set the string to a fixed value. :thinking:

@Loons Is number of digits is always 2?

Yeah always…when the number is under 10 then it’s written “01”

@Loons Can you try below one

Str = “the win should never SUM_W31”

str.Replace(“SUM_W”,"")

1 Like

I tried this… The result is correct, but I can’t set the String when it’s not always 31…

HI @Loons - Try this one - (“SUM_W31”).Replace(split(“SUM_W31”,"_W")(1),"")

Thanks,
AK

Hi @Loons,
1.you can use replace function like this
str.Replace(“SUM_W”,"")
2.you can use split and you will get always correct as you said there will be only 2 digits.
str.split("“c)(1).substring(1, str.split(”"c)(1).length-1)
Cheers
If you find this useful mark it as solution.

1 Like

Oh you need only 31 as the result. Then you can just use replace (“SUM_W”,"")

Thanks,
AK

Hi @Loons
let whatever may be the value next to SUM_W we can get that and we dont need to fix it
so the sequence that @Manjuts90 said would work for sure
Cheers @Loons