PrefixString Equivalent for PadString?

Does an equivalent for PadString exist that prefixes a string? I am in this case wanting to create fixed length suffix strings that automatically name waves ....

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


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.
Got it!

Function/S WName(num,len)
    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
You don't need PadString for this. Use the field with specifier with the %d formatter.

In other words,
printf "%.4d", 0
    0000
aclight wrote:
You don't need PadString for this. Use the field with specifier with the %d formatter.

In other words,
printf "%.4d", 0
    0000


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
aclight wrote:
You don't need PadString for this. Use the field with specifier with the %d formatter.

In other words,
printf "%.4d", 0
    0000


Better still ...

      printf "%.*d", len,num


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