How to split string ( Text ) based on punctuations?

Dears,

Is it possible to split string ( Text) based on punctuation: dot “.” , comma “,” “2 Points “:””,“New Line”, …etc ? Thanks

Hi @hsendel,

Have you got an example string?

StringVar.Split({"."},StringSplitOptions.None) will split by dot into an array of strings, you can replace the punctuation as necessary

1 Like

Thanks @william.coulson , I found one of your answers here : Split sting and add it to array - #4 by william.coulson
By the way is it possible to include all those punctuation in single command?

Hi @hsendel,

Have a look at this topic and see if it helps you:

1 Like

What should be the variable type here : String[ ] ?
Command :
tugna
Error Message :
tugna

Hi @hsendel,

ListPhrases needs to be List<String> (System.Collections.Generic.List<System.String>)
image

1 Like

Great !!! How to exclude the empty lines ?

Hi @hsendel,

Try StringVar.Split({"."},StringSplitOptions.RemoveEmptyEntries).ToList

This was suggested on the topic I linked earlier

1 Like

Hello @william.coulson , Unfortunately it’s not removing empty spaces, Probably need to remove empty lines first, no?

Fixed on Delete new line and unwanted space - #9 by Vijay_Tulsalkar
Thanks a lot @william.coulson for your support

1 Like

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