nl_tokens: ------------------------------------------------------------------- http : // tc39 . github . io / proposal - string - pad - start - end /
pl_tokens: function StringPad ( thisString , maxLength , fillString ) { maxLength = TO_LENGTH ( maxLength ) ; var stringLength = thisString . length ; if ( maxLength <= stringLength ) return "" ; if ( IS_UNDEFINED ( fillString ) ) { fillString = " " ; } else { fillString = TO_STRING ( fillString ) ; if ( fillString === "" ) { // If filler is the empty String, return S. return "" ; } } var fillLength = maxLength - stringLength ; var repetitions = ( fillLength / fillString . length ) | 0 ; var remainingChars = ( fillLength - fillString . length * repetitions ) | 0 ; var filler = "" ; while ( true ) { if ( repetitions & 1 ) filler += fillString ; repetitions >>= 1 ; if ( repetitions === 0 ) <mask> ; fillString += fillString ; } if ( remainingChars ) { filler += % _SubString ( fillString , 0 , remainingChars ) ; } return filler ; }