Say we have the following string
string data= "/temp string";
If we want to remove the first character / we can do by a lot of ways such as :
data.Remove(0,1);
data.TrimStart('/');
data.Substring(1);
But, really I don't …
How can I remove all white space from the beginning and end of a string?
Like so:
"hello" returns "hello"
"hello " returns "hello"
" hello " returns "hello"
" hello world " returns "hello world"
I have the following code
string line = "";
while ((line = stringReader.ReadLine()) != null)
{
// split the lines
for (int c = 0; c < line.Length; c++)
{
if ( line[c] == ',' && line[c - 1] == '"' && line[c + 1] == '"…