Hello,
I have created a list of strings like this one:
“123456
789
123456”
I would like to convert it into:
“12345
67891
23456”
So that each sentence has 5 characters.
Thanks!
Hello,
I have created a list of strings like this one:
“123456
789
123456”
I would like to convert it into:
“12345
67891
23456”
So that each sentence has 5 characters.
Thanks!
Hi,
I dont know how to do it in a simply way. I guess that I would make a loop in fact to get each string of the list and then apply some logic, like substring or something like that…
If I have time I will try to make a test.xaml for you
Regards,
Pablo
take the whole string split it by delimiters(newline). make a single continues string of the numbers. iterate the string with a counter of 5 and then enter a new line. you will get the desired result.
First you would need to combine the list of strings into one:
StringList = String.Join(" ",List)
Then you would need to split that string again based on a substring of 5 characters:
List = Enumerable.Range(0,StringList.Length\5).[Select](Function(i) orig.Substring(i*5,5)).ToList()
Nice @TimK
I was on the same track
Just if you want to see how the result is:
System.Text.RegularExpressions.Regex.Replace(address,"[\n]","")
Enumerable.Range(0, Cint(lines.Length/5)).[Select](Function (i) lines.Substring(i*5,5)).ToList
The address data type would not accept the string,
“123456
789
123456”. for my ui path. Can you clarify that?
it will, just click on Ok and you should be good.
yeah, should have just tried thanks
Thanks.
“address” in my case should be a list of strings, not a unique string.
Would that work?
Thanks a bunch.
Best regards. Have a nice weekend.
One more question. What if the list of strings is like this one:
“123456
123”?
I should be like
“12345
6123”
I think your solution does not work in this case. Am I right?
No, that logic will not give you this result.
it depends on the length being a multiple of 5.
For all cases if you want to split. Example- 5,4 or, 5,1 or, 5 or 5,5,1 or 5,5,5
Enumerable.Range(0, Cint((Math.Round(lines.Length/5.0)*5)/5)).[Select](Function (i) lines.Substring(i*5,Math.Min(lines.Length - (i*5),5))).ToList
I make the count a multiple and then i chunk it to x5 and then renaming
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.