public static string[] StringToLines(string inString)
{
string[] org = inString.Split('\n');
int count = org.Length - 1;
string[] outString = new string[count];
try
{
for (int i = 0; i < count; i++)
{
if (org[i].IndexOf('\r') == -1)
org[i] = org[i];
else
org[i] = org[i].Remove(org[i].IndexOf('\r'));
//int j = org[i].IndexOf('\r');
outString[i] = org[i];
}
}
catch
{
return null;
}
return outString;
}
1 則留言:
試這語法?
String.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries);
張貼留言