This article is a mirror article of machine translation, please click here to jump to the original article.

View: 22542|Reply: 2

[Source] C# implements the string character to split multiple rows into arrays or collections

[Copy link]
Posted on 6/4/2015 9:38:48 PM | | |
When we call a method, we may return a string type

Many times, the string we return is single-line, rarely multi-line...

One method I will call today is to display multiple lines of text, and then I want to cut it into arrays or collections,

I found the information from the Internet for a long time and shared it with you, the code is as follows:

  1. string[] a = sql.Split(new string[] { "\r\n" }, StringSplitOptions.None);
Copy code






Previous:Failed to copy "obj\x86\Debug\" to "bin\Debug\". After 1000 milliseconds, the 1st retry begins.
Next:Original tools are essential for invading servers, only for research and learning, do not use for illegal purposes
Posted on 6/5/2015 12:11:20 AM |
I can't understand
 Landlord| Posted on 8/22/2018 9:45:01 AM |
string[] str = txt. Split(Environment.NewLine.ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com