• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

padding with spaces

New Here ,
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

I need to write data to a fixed length file. So if I have a field that is 10 characters long but the file has room for 15 spaces I want to pad it with spaces. Can someone tell me the best way to accomplish this?
TOPICS
Advanced techniques

Views

415

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

myString & repeatString(" ", 15-len(myString))

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

Actually that's not a good solution.

The best way to do this is to pad the values, in the source query, using DB functions.

The next best way is to use the LJustify() or RJustify() Coldfusion functions.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

LATEST
interesting. i wasn't familiar with the LJustify() or RJustify() functions. nice 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation