Basically, I want to be able to use string.Split(char[]) without actually defining the char array as a separate variable. I know other languages ββthat you could do like string.split([' ', '\n']); or something like that. How can I do this in C #?
string.Split(char[])
string.split([' ', '\n']);
Here's a really good way to do this:
string[] s = myString.Split("abcdef".ToCharArray());
The above is equivalent to:
string[] s = myString.Split('a', 'b', 'c', 'd', 'e', 'f');
This is not very, but: string.Split(new char[] { ' ', '\n' });
string.Split(new char[] { ' ', '\n' });
you can use this overload:
public String [] Split(params char [] separator)
like this:
yourstring.Split(' ', '\n')
Source: https://habr.com/ru/post/1309232/More articles:How can I sum lines added / deleted by user in git repository? - gitRun Javascript in the body of a Gmail message - mathJavaScript: Given the offset and length of the substring in the HTML string, what is the parent node? - javascriptIterating over two arrays at a time in javascript - javascriptImplementation of the ceil function in C - cRubyMine folder tree not updating - rubymineLink to a disk file from NSManagedObject - fileConfused by the basics of AJAX - javascriptremoving duplicates from a table without using a temporary table - sqlHow to refactor VB6 code to prevent runtime errors - vb6All Articles