How to split a string at every 10th position and add to array

Hi All,

I am getting screenscraping output in string. I want to split in 10th position and add to array. How to do that.

Example:8642425151864242515286424251618645276024
Expected Output
8642425151
8642425152
8642425161
8645276024
Regards,
Hima

@thima
give a try on following:

Assign activity
left side arrSplits (DataType: String())
right side:
Enumerable.Range(0,CInt(Math.Ceiling(strText.Length / 10))).Select(Function (x) New String(strText.Skip(x*10).Take(10).toarray)).toArray

with the redundant use of the segmentsize (10) we suggest to use it within a variable:
VarName: SegementSize, Default Value: 10 DataType: Int32

Variable strText = YourTextString

so the statement changes to:
Enumerable.Range(0,CInt(Math.Ceiling(strText.Length / SegmentSize))).Select(Function (x) New String(strText.Skip(x*SegmentSize).Take(SegmentSize).toarray)).toArray

3 Likes

Thanks its working

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