import { fn } from "https://deno.land/x/ddu_vim@v4.0.0/deps.ts";
const { str2nr } = fn;
Convert string {string} to a number. {base} is the conversion base, it can be 2, 8, 10 or 16. When {quoted} is present and non-zero then embedded single quotes are ignored, thus "1'000'000" is a million.
When {base} is omitted base 10 is used. This also means that a leading zero doesn't cause octal conversion to be used, as with the default String to Number conversion. Example:
let nr = str2nr('0123')
When {base} is 16 a leading "0x" or "0X" is ignored. With a different base the result will be zero. Similarly, when {base} is 8 a leading "0", "0o" or "0O" is ignored, and when {base} is 2 a leading "0b" or "0B" is ignored. Text after the number is silently ignored.
Returns 0 if {string} is empty or on error.
Can also be used as a method
:
GetText()->str2nr()