Hi All,
How to check the String Contains Consecutive OR OR and Replace them with single OR.
Input string = Design OR OR Drawing OR Painting
Output string = Design OR Drawing OR Painting
Note : this number of OR is not fixed it can be more than two also like OR OR OR OR, we have to replace with single OR.
Please help
Regards
Ritesh
Yoichi
(Yoichi)
2
Hi,
Can you try the following expression?
System.Text.RegularExpressions.Regex.Replace(yourString,"(\bOR )+","OR ")
Regards,
1 Like
Hi @Yoichi ,
ile:
Facing an issue actually in my Real input data input string is like this
Input string = Design OR OR Drawing OR Painting
Note : in between Two OR there is spaces because of which the above code is failing to make it as a single OR.
Could you please help?
Regards,
Ritesh
Yoichi
(Yoichi)
5
Hi,
How about the following expression?
System.Text.RegularExpressions.Regex.Replace(yourString,"(\bOR +)+","OR ")
or
System.Text.RegularExpressions.Regex.Replace(yourString,"(\bOR\s+)+","OR ")
Regards,
1 Like
Hi @Yoichi ,
Could you please help me one more issue there?
if I get the value as single digit as string i need to make it as 0 in the begining example : input = 3
output 03
Regards,
Ritesh
Yoichi
(Yoichi)
8
HI,
Hope the following helps you.

CInt(yourString).ToString("00")
or if there might be extra whitespaces, Trim method helps you.
CInt(yourString.Trim).ToString("00")
Regards,
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.