Shmewnix Shmewnix - 1 year ago 104 Question

How to Trim consecutive Characters

I'm looking to trim (drop) consecutive characters, and everything in front of it in

An example of the output:


What I'd like to do - is trim '01' and any character in front of it. So my desired output would be:


I attempted to use

Dim charsToTrim() As Char = { "01"c}

However, you're only allowed to use 1 character at a time this way in Since i may have "0" or "1", I can't break it up like this:

Dim charsToTrim() As Char = { "0"c,"1",c}

Answer Source
Function Trim01(ByVal input As String) As String
    Dim pos = input.IndexOf("01")

    Return If(pos >= 0, input.Substring(pos + "01".Length), input)
End Function
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download