• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2257
  • 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 OlivaresSoftware ArchitectCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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