Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick PB 6.5 code question - Padding function?

Status
Not open for further replies.

Jitwad

Programmer
Sep 8, 2002
13
CA
Just looking for a string/text function that can pad a string to a specific length --- similar to the LPAD or RPAD functions in PL/SQL.

e.g. -- rebuilding a command line. The first section (string) must be 10 chars long -- but the possible values that must be put into it are 5 or 6 characters. Can I make PB pad that string to 10 chars - regardless of which of the 2 var's are selected - in one statement?

 
You need to create a separate PAD function that accomplishes what you want and returns the padded string. Then you can call this new PAD function and use it in a single line of script.

I'd include the following parameters in the PAD function:

1. Initial string
2. Left or Right PAD flag
3. Pad character
4. Final length of string

This is a simple function to create, and frankly I'm surprised that it's not included as part of PB's set of tools.


Olan
 
Yes, PB lacks a PAD function.
Sometimes I do this:

ls_text = left(ls_text + space(10),10)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top