字串陣列宣告
string[] array = new string[] { "A", "B", "C", "D", "E" };
string[] array = { "A", "B", "C", "D", "E" };
字串轉字串陣列、字串陣列轉字串
string[] d = "1,2,3".Split(','); |
string f = String.Join(",", d);
字串陣列轉List
List<string> listStr = new List<string>(array);
字串陣列委派
var days = Array.FindAll(array,match);
public static bool match(string str)
{
if (str == "A")
return true;
if (str == "B")
return true;
return false;
}
List委派
var days = listStr.FindAll(match);
public static bool match(string str)
{
if (str == "A")
return true;
if (str == "B")
return true;
return false;
}
張貼留言