Hi team,
I am struck with one example like how to split the string in to even and ODD
For example, I have even a string like “ABCDEFGH” I have to split this as “AB CD EF GH”
If I have a Odd string “ABCDEFG” I have to split like “A BC DE FG”
Could any one help me on this
Thanks in advance
Yoichi
(Yoichi)
2
Hi,
How about the following expression?
arrStr = System.Text.RegularExpressions.Regex.Matches(yourString,".{1,2}",System.Text.RegularExpressions.RegexOptions.RightToLeft).Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Value).Reverse().ToArray()
Regards,
For Even String Like “ABCDEFGH” I Need the output as “AB CD EF GH”
Thanks in advance
Yoichi
(Yoichi)
5
Hi,
Why do you use ForEach activity? If str
is string type variable, the following will work.
arrStr = System.Text.RegularExpressions.Regex.Matches(str,".{1,2}",System.Text.RegularExpressions.RegexOptions.RightToLeft).Cast(Of System.Text.RegularExpressions.Match).Select(Function(m) m.Value).Reverse().ToArray()
Then
String.Join(" ",arrStr)
note: arrStr is String array type.
Regards,
Sorry for this. Understood. Could you please help me for Even String as well.
Thanks in advance
Yoichi
(Yoichi)
7
Hi,
The above expression also works.
Regards,
1 Like
system
(system)
Closed
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.