Zero pad function trim extra leading zeros Here is a zero pad function I have:

''' &lt;summary&gt;
''' Take a number string and zero pad it to the specified length.
''' &lt;/summary&gt;
''' &lt;param name="Number"&gt;The string representation of the value that will be zero-padded.&lt;/param&gt;
''' &lt;param name="ToLength"&gt;The length of the string that will result after the zero-padding.&lt;/param&gt;
''' &lt;param name="TrimExtraZeroes"&gt;An optional boolean which, when true, indicates that any 
''' extra leading zeroes that make the string longer than the desired length should be removed.&lt;/param&gt;
''' &lt;returns&gt;A value which is the same as &lt;paramref name="Number" /&gt; but zero padded to the length specified by &lt;paramref name="ToLength" /&gt;.&lt;/returns&gt;
''' &lt;remarks&gt;&lt;/remarks&gt;
Friend Function ZeroPad(ByVal Number As String, ByVal ToLength As Integer, Optional ByVal TrimExtraZeroes As Boolean = False) As String
    Const ZeroChar = "0"c

    Select Case Number.Length
        Case Is &lt; ToLength
            Return New String(ZeroChar, ToLength - Number.Length) &amp; Number
        Case Is = ToLength
            Return Number
        Case Is &gt; ToLength
            ZeroPad = Number

            If (TrimExtraZeroes) Then
                Do While ZeroPad.StartsWith(ZeroChar) AndAlso ZeroPad.Length &gt; ToLength
                    ZeroPad = ZeroPad.Substring(1)
                Loop
            End If
        Case Else
            'This case can never occur, but it's here to suppress compiler warning.
            Throw New InvalidOperationException(String.Format("Unknown number length: {0}", Number.Length))
    End Select
End Function


Now, focusing on just one portion of it -- the part that trims leading zeros:

Do While ZeroPad.StartsWith(ZeroChar) AndAlso ZeroPad.Length &gt; ToLength
    ZeroPad = ZeroPad.Substring(1)
Loop


is there a more efficient, cleaner, or "slick" way to do this other than looping?
Naming  

Based on the naming guidelines parameters should be named using camelCase casing.  

Select Case

If you omitt the Case Is &gt; ToLength and the else part aka having only 2 cases you will have  

Friend Function ZeroPad(ByVal Number As String, ByVal ToLength As Integer, Optional ByVal TrimExtraZeroes As Boolean = False) As String
    Const ZeroChar = "0"c

    Select Case Number.Length
        Case Is &lt; ToLength
            Return New String(ZeroChar, ToLength - Number.Length) &amp; Number
        Case Is = ToLength
            Return Number
     End Select

     If (TrimExtraZeroes) Then
         Do While Number.StartsWith(ZeroChar) AndAlso Number.Length &gt; ToLength
             Number = Number.Substring(1)
         Loop
     End If
    Return Number
End Function  


Why don't you use the built in String.PadLeft() method which would obsolete the Select Case. In addition to first stripping any 0 of the left side of Number you won't need the loop at all.  

This boils down to only this     

Friend Function ZeroPad(ByVal Number As String, ByVal ToLength As Integer, Optional ByVal TrimExtraZeroes As Boolean = False) As String
    Const ZeroChar = "0"c
    If (TrimExtraZeroes) Then
        Number = Number.TrimStart({ZeroChar})
    End If
    Return Number.PadLeft(ToLength, ZeroChar)
End Function  


Update
Some timetables for calling both methods 1.000.000 times  

                                    Yours(ms)  Mine(ms)
ZeroPad("0000000001", 2, False)       227       231
ZeroPad("0000000001", 2, True)       1696       297
ZeroPad("01", 2, False)               251       235
ZeroPad("01", 2, True)                248       263  
ZeroPad("01", 12, False)              256       247
ZeroPad("01", 12, True)               257       260