Re: DCL minute of the Day: integer to string, padded & right justified

From: Charlie Hammond (hammond_at_not@peek.ssr.hp.com)
Date: 04/02/04


Date: Fri, 02 Apr 2004 20:05:59 GMT

In article <c4k8n2$125u$1@biggoron.nerim.net>,
Didier Morandi <no@spam.com> writes:

>I need to do this:
>
>source: an integer between 1 to 99999
>dest: a string 5 chars long with the number right justified and padded with spaces
>
>Of course, I can use Charlie H.'s processing (in DCL_DIET.COM):
>
>$ line_nr = "00000"
>$ line_nr[5-f$len(lines_in),f$len(lines_in)] := 'lines_in'
>
>to justify/pad with zeros in that case, but I wondered if it was possible to do
>it with F$FAO.

Hmmm... I don't think that is my code, Didier. At least I don't
remember it and can't locate it. I think I'd be more likely to
do something like the following:

    $ source = 345 ! for example
    $ line_nr = f$ao("!5AS",f$string(source))
$! Using ">" and "<" to show spaces better
    $ write sys$output ">" + line_nr + "<"
>345 <

-- 
      Charlie Hammond -- Hewlett-Packard Company -- Ft Lauderdale  FL  USA
          (hammond@not@peek.ssr.hp.com -- remove "@not" when replying)
      All opinions expressed are my own and not necessarily my employer's.