SQL PHP HTML ASP JavaScript articles and free scripts to download
SQL String Functions

LPAD mysql string function

We can pad a string from left or from right by using LPAD or RPAD function respectively. We will use some examples to understand how these functions works. Here we will take plus2net as our input sting.

Example of LPAD

SELECT LPAD('plus2net',13,'**');

The output is here


You can see we have plus2net of 8 characters long. To this we have added or Pad at left ( at starting ) so the resultant string is of total 13 chars length.
What if the required length is less than the original string?

SELECT LPAD('plus2net',2,'**');

The output is here


This is first two chars of our input sting only.

Be the first to post comment on this article :


Post Comment This is for short comments only. Use the forum for more discussions.
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2015 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer