legacy String command

  • Thread starter Thread starter Duncan Welch
  • Start date Start date
D

Duncan Welch

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(sNumber, iLength)
If Len(sNumber) >= iLength Then
PadNumber = sNumber
Else
PadNumber = String(iLength - Len(sNumber), "0") & sNumber
End If
End Function
 
Hi Dunc,

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

HTH
Ravikanth
 
Back
Top