_.parseInt(string, [radix=10])
Converts string
to an integer of the specified radix. If radix
is undefined
or 0
, a radix
of 10
is used unless value
is a hexadecimal, in which case a radix
of 16
is used.Note: This method aligns with the ES5 implementation of parseInt
.
Since
1.1.0
Arguments
string
(string): The string to convert.[radix=10]
(number): The radix to interpretvalue
by.
Returns
(number): Returns the converted integer.
Example
_.parseInt('08');// => 8_.map(['6', '08', '10'], _.parseInt);// => [6, 8, 10]
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .