How to split int no without seperator

Hello folks,
Suppose I have enter no using input dialogue activity , no will be like:- 4589
And I want to split no like:-
4
5
8
9
How can I do??

Here’s a solid post I found that may allow you to find a solution

Hello Naveen,
you can use “Strvalue.ToCharArray” like below
1- Create Variable for your string (Str) with your value.
2- Create Array of type Char under system.char (arrstr)
3- use assign activity as arrstr–> Str.ToCharArray
4- then use for each loop on you arrstr.

Screen of process:
image

Screen of Variables:

Screen of Output:
image

1 Like

Hi @Naveen_Kumar2 ,

Is this what you were looking for?

There are two ways to achieve this using Regex →

System.Text.RegularExpressions.Regex.Matches(str_rawString,"\d").Cast(Of Match).Select(Function(s) s.ToString).ToArray()
System.Text.RegularExpressions.Regex.Split(str_rawString,"(?<=\d)").
	Where(Function(w) Not (IsNothing(w) OrElse String.IsNullOrEmpty(w.ToString))).ToArray()

MatchingWithoutDelimiters.xaml (5.3 KB)

Kind Regards,
Ashwin A.K

1 Like

Hi Can you please give explain both of regex expression for better learning I really appreciate you.
I did not understand “Cast(Of Match).Select(Function(s) s.ToString).ToArray()”,“Split(str_rawString,”(?<=\d)“).
Where(Function(w) Not (IsNothing(w) OrElse String.IsNullOrEmpty(w.ToString))).ToArray()”

The pattern detects the empty gaps between each number:

image

Then Where clause in the LINQ filters out empty results(Blanks) and converts the rest to Array.

Kind Regards,
Ashwin A.K

2 Likes

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