Split a text by 3 line

Hello guys,

I’m getting via OCR a pdf text and i want to split it by 3 line, what would be the pattern of the .split function?

you want to split into different new lines?

yes but each item will be a concatenation of 3 lines

yourVarString.Split(Environment.NewLine.TocharArray)
this will split your string into new lines

yes but it will split line by line
i want to split it by 3 line, exemple:

asazaz
ljljjl
afarar
rzrzr
sdfsf
fghfh
jhjh
output:
item1
asazaz
ljljjl
afarar
item2 :
rzrzr
sdfsf
fghfh

Can you send me some sample lines.

refer this post

Use this below regex to your lines of string,
System.Text.RegularExpressions.Regex.Matches(str,“[\w]+.*”),
You will get the match collection from this and display the lines using for each.

2 Likes

done

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