How to Trim and Split string to textbox
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; //