Remove characters into a string from determined characters


#1

Hi there !

I would like to remove from a string a part which always begins by “of”.

Here some examples / My raw data :
“1 of 1111”
“2 of 1000”
“99 of 9999”

I would like these results :
1
2
99

So how can i remove any characters after “of” occured ?

Thanks a lot !


#2

Hi @Simon_RUMEL_SIXDENIE,

Use the below code.

Assign String2= String1.substring(1, string1.indexof(“of”)-1)


#3

Hi Vivek,
Small change in your reply
Assign String2= String1.substring(0, string1.indexof(“of”)-1)