i want to create a simple program that i have a array of strings and for each string i want to check if it contains specified character, i want to remove it.first of all i replace the specified characters with space and when i tried to trim the spaces it doesn’t work
Here it is my code
char[] arr = new char[] {' '};
for (int i = 0; i < words.Length; i++)
{
words[i] = words[i].Replace('0', ' ');
words[i] = words[i].Trim(arr);
}
If you want to remove all spaces, instead of
words[i] = words[i].Trim(arr);, you can use:Personally, I would do this for your first removal (0) as well:
Or, even: