John

John

  • NA
  • 43
  • 33.6k

Removing character from string

Jul 22 2013 1:02 PM
Hi All,

I'm trying to remove 2 characters at the beginning of a string but its not working.

this is the code:

if (preview.StartsWith("\\"))
            {
                preview.Remove(0, 2);
                FileInfo prev2 = new FileInfo(preview);

            }


so the string begins with "\\" which I want to get rid of. But despite the code above the string stays the same.

Cheers

Answers (1)