I have this string: \"NT-DOM-NV\\MTA\" How can I delete the first part: \"NT-DOM-NV\\\" To have this as result: \"MTA\"
How is it possible with RegEx?
string.TrimStart(what_to_cut); // Will remove the what_to_cut from the string as long as the string starts with it.
"asdasdfghj".TrimStart("asd" ); will result in "fghj".
"qwertyuiop".TrimStart("qwerty"); will result in "uiop".
public static System.String CutStart(this System.String s, System.String what)
{
if (s.StartsWith(what))
return s.Substring(what.Length);
else
return s;
}
"asdasdfghj".CutStart("asd" ); will now result in "asdfghj".
"qwertyuiop".CutStart("qwerty"); will still result in "uiop".