user5876164
user5876164

Reputation: 503

How can I find a string between repeated strings in C#?

How can I find a string between repeated strings? For example, if

string str = @"||AAA||BBB||CCC||";

how can I find all the strings(AAA, BBB, CCC) in order between repeated strings(||)?

Upvotes: 0

Views: 53

Answers (1)

adjan
adjan

Reputation: 13652

Just use String.Split:

var str = @"||AAA||BBB||CCC||";
var splits = str.Split(new string[] {"||"}, StringSplitOptions.RemoveEmptyEntries);

Upvotes: 4

Related Questions