I am try to trim ABCD - abcd ,I want output :
fList_s.Text = ABCD
fList_d.Text = abcd
but fList_s.Text = ABCD - abcd
String strList = "ABCD - abcd"
string[] items = new string[]
{
strList
};
foreach (string item in items)
{
string trimmed = item.TrimStart('-', ' ');
fList_s.Text = trimmed; //
}
char[] charsToTrim = { '-', ' ' };
string[] words = strList.Split();
foreach (string dest in words)
fList_d.Text = dest; //
How to Trim and Split string to textbox
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Jan 29, 2014, 6:39 AM EST
Thanattha Bussapak20 reputationPosted Jan 29, 2014, 6:47 AM EST