String removal

Hai
i have three strings
B2345
B-2345
82345

in above i want only 2345

1 Like

try this @veera_g

str.Substring(str.Length -4)

where str is the text you have

1 Like

Good morning Veera,

We can do this very easily using regular expressions.

Try this in an assign stage:
string b= System.Text.RegularExpressions.Regex.Replace(“string_Variable”,“\D”,“”)

Source:

Hey @veera_g
Use right function to read that.
For more information refer this

Instead of overcomplicating it, just use str.Right(5)

1 Like

Do you mean this?? Will this get the result user wanted(User wanted only 2345)?? If yes , could you please show us?

Sorry, it should be 4 instead of 5, but yes Right will get the result they want - assuming it’s always the last 4 characters of the string. The OP didn’t specify, so we can only assume.