PrefixString Equivalent for PadString?
jjweimer
extraction 1/614 ---> wave001
extraction 2/614 ---> wave002
...
extraction 54/614 --> wave054
...
extraction 523/614 --> wave523
All I know at the outset is how many waves will be created (meaning, how long the digit allocation should be). Useful in this case would be when PadString would have an optional "prefix" flag PadString(str,finalLength,padValue,[prefix]) to be used as ...
Function/S WName(num,len)
variable num,len
string theName
sprintf theName, "%d", num
return ("wave" + PadString(theName,len,"0",1))
end
variable num,len
string theName
sprintf theName, "%d", num
return ("wave" + PadString(theName,len,"0",1))
end
Also, the documentation of PadString does not really explain clearly enough the format type for padValue (it seems to be a hexadecimal code????). Perhaps a short example would be useful.
variable num,len
string theName
sprintf theName,"%s%d", PadString("wave",len+4,char2num("0")), num
return theName
end
I would still wish to have an optional "prefix" flag for PadString.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 12, 2010 at 03:32 pm - Permalink
In other words,
0000
July 12, 2010 at 05:28 pm - Permalink
Oh! I hadn't thought such would work with integer conversions and so didn't even bother to try. Thanks!
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 12, 2010 at 06:39 pm - Permalink
Better still ...
I would still suggest PadString have a prefix flag ... useful for example for generating "right justified", uniformly-sized text arrays.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
July 14, 2010 at 02:54 pm - Permalink