Re: Formatting with printf

2002-01-10 Thread Scott
On Wed, 9 Jan 2002, John W. Krahn wrote: > printf is based on the C language printf function and can be a bit > tricky. The format "%-5s" will not truncate a value longer than 5 > characters but it will pad a shorter value with spaces. To truncate a > longer value use the format "%-5.5s". Also,

Re: Formatting with printf

2002-01-09 Thread John W. Krahn
Scott wrote: > > Hi all. Hello, > I have a couple of strings that I need to format. One of those fields is > a alpha/numeric string. Here is the code: > > printf NEWQUOTES ("%-5s", @fields[14]); > > When I run the code I get 10 extra spaces before the next field instead of > the 5. The

RE: Formatting with printf

2002-01-09 Thread Bob Showalter
> -Original Message- > From: Scott [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 09, 2002 10:29 AM > To: [EMAIL PROTECTED] > Subject: Formatting with printf > > > Hi all. > > I have a couple of strings that I need to format. One of >

Re: Formatting with printf

2002-01-09 Thread Scott
Cancel the request. The field coming in actually had 10 spaces in it, so I just removed the spaces doing this: $field14 = @fields[14]; $field14 =~ s/ //g; print NEWQUOTES ($field14); On Wed, 9 Jan 2002, Scott wrote: > printf NEWQUOTES ("%-5s", @fields[14]); > When I run the code I get 10 extr

Formatting with printf

2002-01-09 Thread Scott
Hi all. I have a couple of strings that I need to format. One of those fields is a alpha/numeric string. Here is the code: printf NEWQUOTES ("%-5s", @fields[14]); When I run the code I get 10 extra spaces before the next field instead of the 5. The value of @fields[14] is: A2103. Is th