Literal character in C #

I want to compile my code in C #. I parsed the string "....",

string[] parts = line.Split(new[] { '....' }, 2);

Then I got an error message:

Too many characters in a literal character

The line looks like this:

abc....  starting word in english

It seems to me that I need to convert ....to =. Then everything will work fine. Is there another way?

+3
source share
2 answers

Try using the Split method :

string[] parts = line.Split("....", 2, StringSplitOptions.None);
+3
source

You can split only charby passing a single character: '.'.

Separate the line instead:

string[] parts = line.Split("....", 2);
+5
source

Source: https://habr.com/ru/post/1758765/


All Articles