跳转到主内容

//ERDDAP/com.cohort.util/ScriptString2/zeroPad

zeroPad

[JVM]
open fun zeroPad(number: String, nDigits: Int): String

This adds 0's to the left of the string until there are nDigits to the left of the decimal point (or nDigits total if there isn't a decimal point). If the number is too big, nothing is added or taken away.

Return​

the number, left-padded with 0's so there are nDigits to the left of the decimal point

Parameters​

JVM

numbera positive number. This doesn't handle negative numbers.
nDigitsthe desired number of digits to the left of the decimal point (or total, if no decimal point)