How can we split string where we get one or more empty lines in a string,
text.Split({System.Environment.Newline},System.StringSplitOptions.RemoveEmptyEntries)
This will split with new line and empty space will be ignored
its not working
My mistake, Try this text.Split(System.Environment.Newline,System.StringSplitOptions.RemoveEmptyEntries)
Or
Text.split(" “,”")
and a screen shot of what you are getting after this
Hi @Mohsin_Inamdar,
Try this
txtStr.Split(New String() { Environment.NewLine + Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
@Mohsin_Inamdar,
I recently publish custom activity to make life easy. You may want to use it. Its very straightforward.
Example:
Let me know if you need assistance or if you are still facing issue.
Cheers
Whats the solution for this
My input is
"testing split
function
using UiPath"
and I want the output in array as
array(0)-testing split
function
array(1)-using UiPath
to split by new line below code works,
yourstring.Split(System.Environment.Newline,System.StringSplitOptions.RemoveEmptyEntries)
you can refer to the uploaded file if you want to split only by empty newlines
I haves used regex to split
System.Text.RegularExpressions.Regex.Split(txtStr,“\n{2,}”)
Hope that helps
StringSplit.zip (2.9 KB)