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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Strings 1

Status
Not open for further replies.

ganjass

Technical User
Dec 30, 2003
154
GB
CR8

Hi I need to format strings of a certain length, which is fine. But how would i go about padding the string to the max length if the string is below the max length. eg the max length it 40 and the string is 20, how would i pad it out with spaces

Cheers
 
This will work in 8.5 and should work in v8.

@Pad out field
Code:
whileprintingrecords;
numberVar MaxLength := 40;  //replace with your max

If Length({table.field}) < MaxLength then
    {table.field} + Space(MaxLength - Length({table.field}))
Else
    Left({table.field},MaxLength)


~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top