Documentation for /home/davin/idl/socware/

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

projects/themis/common/

num_to_str_pad.pro


Routines

top source num_to_str_pad

result = num_to_str_pad(val, len, pad=pad, integral=integral)

Procedure: num_to_str_pad Purpose: This is a very basic operation that gets repeated a lot in date file output. This takes a number as input and pads zeros on the front so that the number outputs at fixed field width. Inputs: val: The number to be converted len: The final length requested Keywords: pad: Select a character other than '0' with which to pad integral: Normally, if val is a floating point type, if will add a .00, If this keyword is set, forces no decimal points. Notes: 1. For a while I resisted putting this in the distribution as it seemed too specific an operation, but at the point when I was considering implementing this routine for a 4th time in a separate namespace, I just decided to go ahead and add this instead. 2. There is no error checking to determine if the input is wider than 'len' 3. Currently floating point inputs will produce unreliable results. Example: date_str = num_to_str_pad(year,4)+num_to_str_pad(mon,2)+num_to_str_pad(day,2) $LastChangedBy: pcruce $ $LastChangedDate: 2010-03-16 18:00:51 -0700 (Tue, 16 Mar 2010) $ $LastChangedRevision: 7416 $ $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/themis/common/num_to_str_pad.pro $

Parameters

val
len

Keywords

pad
integral

File attributes

Modification date: Thu Feb 13 16:42:32 2014
Lines: 17