For example: trains, planes, automobiles.
In such a case, this method may come in handy:
public static string delimitString(string str){
string[] arr = str.Split(',');
StringBuilder sb = new StringBuilder();
foreach (string s in arr)
{
sb.Append("'" + s.Trim() + "',");
}
sb.Length--;
return sb.ToString();
}
The resulting string will look like this: 'trains', 'planes', 'automobiles'
No comments:
Post a Comment