Hello everybody and thanks in advance for your help.
I would like to split a text but using the number of line of this text.
I’ll try to explain it as most precisely as possible.
Imagine you’ve a text which contain 30 lines. In a text area, i’m limited to 25 lines so i need to split my text into two parts: the first one containing max 25 lines and the second one containing the rest of the text.
Due to the fact that i can’t know in advance which character will be the last of the 25th line, how can i use the line number to split my text into two parts ?
Thanks for your help. This will not work because of the fact that Substring will cut my string from the first character to the 25th character included but not from the first line to the 25th line.
when your case is still open and splitting the data is unclear due to the linebreak is not recognized, feel free to share with us some sample data as a text file. Let us also know from where the text content is retrieved (File, Webapp…)
First => ArrayOfString = String1.Split(Environment.NewLine.ToCharArray()) where String1 is my full text
Second => Initialization of an Index to 0 and
While Index < 25
String3 = String.Concat(String2, ArrayOfString(Index)
String2 = String3
Index = Index + 1
where String2 will be my final result and String3, an intermediate result.
At the end, i’ve my Result, String2, which contains my 25 first line of the initial text from which i wanted the split.