How do i split a list<string> by pipe symbol

trying to split my list of strings by { | }

the following code is not working ListOfStrings.Split({“ | ”},StringSplitOptions.None)

any help?

So, do you have a list of strings with pipes in them (e.g. {“this|is|a|string”, “and|this|is|another”, “this|is|the|last”})?

If this is incorrect, can you provide an example? If this is correct, are you trying to create a list of lists of strings by splitting these?

1 Like

@J_Swali, Do you really have space before and after “|” . Please try below expression:

stringVariable.Split("|".ToCharArray, StringSplitOptions.None)

Alternatively you can use following component. It will be easy to use and more readable.

Cheers,

1 Like

issue resolved! thanks guys

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