1
Answer

Removing character from string

Ask a question
John

John

11y
834
1
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)