I have a string which contains only numbers: “4000124872345678”. I want to split it into an array. Each element contains 4 numbers(or characters): array(0)=“400”,array(1)=“1248”, array(3)=“7234” and array(4)=“5678”. How to do that?
Hi @hemanth_chinna,
Use this code to get the data array
System.Text.RegularExpressions.Regex.Split("4000124872345678", "(?<=\G.{4})")
using write line activity to print the splited data
string.Join(",",System.Text.RegularExpressions.Regex.Split("4000124872345678", "(?<=\G.{4})"))
Regards,
Arivu
1 Like
Hi @arivu96… how to do if we want to split in different size. like one element contain first 4 and second element contain next 6 digits , then how to do.
Hello @Teja_L
one method would be to convert the int to string and split it according to your condition & assign a new variable for it
like this Main.xaml (8.7 KB)
hello @Teja_L we have chosen 4 as a separator.
do one thing use this Substring method it will be easy for you to implement