首页 > 试题广场 >

Implements the function String

[问答题]
Implements the function String padStart(Stirng stirng, int minLength,char padChar)
return a string, of length at least minLength,consisting of string prepeneded with as many copies of pdaChar as are necessary to reach that length. For example,
padStart("7",3,'0') returns "007"
padStart("2010",3,'0') returns "2010"
Parameters:
string The string which should appear at the end of the result
minLength The minumum length the resulting string must have. Can be zero or negative, in which case the input string is always returned
pdaChar the character to insert at the beginning of the result until the minimum length is reached
returns:the padded string

这道题你会答吗?花几分钟告诉大家答案吧!