• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2239
  • Last Modified:

using padleft function in VB.net

I am trying to understand the usage of Padleft function. I wrote this code but when I display the xstring variable it doesn't show any change.

any idea?

thanks


 Dim xstring As String = "abcadabraheroColorado"
        xstring = xstring.PadLeft(4, "PPPP")
        MsgBox(xstring)

0
jskfan
Asked:
jskfan
2 Solutions
 
Jaime OlivaresCommented:
Pad will take effect when your string lenght is lower than the 1st argument of PadLeft. In that case, PadLeft() will add characters up to the lenght specified. By example, try with:
xstring = xstring.PadLeft(40, "PPPP")
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now