legacy String command

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Duncan Welch

    #1

    legacy String command

    Hi,

    Back in classic ASP, there used to be a string function that generated x
    occurances of a given character. Does anyone know the equivalient in
    ASP.NET?

    Thanks in advance

    Dunc

    ---/ snip /---

    ' Old ASP function to keep strings all the same length...
    Function PadNumber(sNumb er, iLength)
    If Len(sNumber) >= iLength Then
    PadNumber = sNumber
    Else
    PadNumber = String(iLength - Len(sNumber), "0") & sNumber
    End If
    End Function


  • Ravikanth[MVP]

    #2
    legacy String command

    Hi Dunc,

    you can use String.PadLeft and String.PadRight methods to
    pad left/right with specified length.

    HTH
    Ravikanth

    [color=blue]
    >-----Original Message-----
    >Hi,
    >
    >Back in classic ASP, there used to be a string function[/color]
    that generated x[color=blue]
    >occurances of a given character. Does anyone know the[/color]
    equivalient in[color=blue]
    >ASP.NET?
    >
    >Thanks in advance
    >
    >Dunc
    >
    >---/ snip /---
    >
    >' Old ASP function to keep strings all the same length...
    >Function PadNumber(sNumb er, iLength)
    > If Len(sNumber) >= iLength Then
    > PadNumber = sNumber
    > Else
    > PadNumber = String(iLength - Len(sNumber), "0") &[/color]
    sNumber[color=blue]
    > End If
    >End Function
    >
    >
    >.
    >[/color]

    Comment

    Working...