Dear Gabriel,
Actually I needed this (these) code(s) in macro and have already solved my needs by the following small macros:
function padStart(str, digits, ins) {
while (lengthOf(str) <digits)
str = ins + str;
return str;
}
function padEnd(str, digits, ins) {
while (lengthOf(str) <digits)
str = str + ins;
return str;
}
for which I inspired from the pad method code found in the ij.IJ.java file.
I was just asking whether there could be a need for further extension of the existing method since I may not be the only one needed this.
Take care,
Philippe
----- Mail original -----
De: "Gabriel Landini" <
[hidden email]>
À: "imagej" <
[hidden email]>
Envoyé: Vendredi 12 Juin 2020 13:06:35
Objet: Re: Extension of the IJ.pad method
Hi, would this help?:
https://stackoverflow.com/questions/388461/how-can-i-pad-a-string-in-javaYou use String.format() and then the replace method.
Cheers
Gabriel
On Friday, 12 June 2020 11:43:17 BST
[hidden email] wrote:
> Dear all,
> Would it be of common interest to have a IJ.pad(n, length, str) method which
> would able to pad whatever string (i.e. not only zeros)? Actually in my
> application, I would need to pad spaces (i.e. having str = " "). I thank
> you very much for your lighting on this.
> My best regards,
> Philippe
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html