Gossamer Forum
Home : General : Perl Programming :

printf - need help with attribute

Quote Reply
printf - need help with attribute
I use the following with no problems

$bob = "a string";

printf("%-15s",$bob);

to print the following (padded to 15 characters):

"a string_ _ _ _ _ _ _"

However, I'm having trouble locating the attribute that would truncate the string. I have a field that I simply want to print on a page that is *limited* to x number of characters and was trying to use printf.

Example:

$bob = "a really long string and I only want part of it";

would return:

"a really long stri";
Subject Author Views Date
Thread printf - need help with attribute Watts 7225 Aug 22, 2006, 8:26 AM
Thread Re: [Watts] printf - need help with attribute
fuzzy logic 7011 Aug 22, 2006, 4:49 PM
Post Re: [fuzzy logic] printf - need help with attribute
Watts 7055 Aug 23, 2006, 8:22 AM
Thread Re: [Watts] printf - need help with attribute
mkp 7011 Aug 26, 2006, 7:06 PM
Thread Re: [mkp] printf - need help with attribute
Watts 7017 Aug 28, 2006, 7:37 AM
Thread Re: [Watts] printf - need help with attribute
fuzzy logic 6977 Aug 28, 2006, 12:46 PM
Thread Re: [fuzzy logic] printf - need help with attribute
mkp 6964 Aug 31, 2006, 10:05 AM
Thread Re: [mkp] printf - need help with attribute
Watts 6970 Aug 31, 2006, 10:20 AM
Post Re: [Watts] printf - need help with attribute
fuzzy logic 6976 Aug 31, 2006, 8:50 PM