How to remove only US test in string "US USA"

how to remove US text from String as below

“US USA”

answer need only USA

Hi @Ram_Gurav1

Try the expression below!

Split(YourStringVar," ")(1)

will give the result USA

Regards

some time not available “US”

that’s why we need to replace option

Hi @Ram_Gurav1

Please try this,

strText - your variable name

string.join(" ",strText.split(" "c).select(function(d) not d.tostring.trim.toupper.equals("US")).toarray)

Thanks

@Ram_Gurav1

As any alternative you can use IF condition as

“US USA”.Equal(“USA”)

Then-> False
Else → use your logic

Hope this will help you

Thanks

thanks to all for helping me
i have used below function its work

System.Text.RegularExpressions.Regex.Replace(abs,"\bUS\b","").Trim

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.