Reputation:
I want to compile my C# code. I was parsing a string by "....",
string[] parts = line.Split(new[] { '....' }, 2);
Then I got an error:
Too many characters in character literal
The line looks like this:
abc.... starting word in english
I think that I need to convert ....
to =
. Then everything would work fine. Is there any other way?
Upvotes: 3
Views: 4309
Reputation: 1039498
Try using the Split method:
string[] parts = line.Split("....", 2, StringSplitOptions.None);
Upvotes: 3
Reputation: 68516
You can only split by char
by passing a single character: '.'
.
Split using string instead:
string[] parts = line.Split("....", 2);
Upvotes: 5