Skip to main content
Module

x/ddc_vim/deps.ts>fn.str2nr

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.str2nr
import { fn } from "https://deno.land/x/ddc_vim@v0.0.13/deps.ts";
const { str2nr } = fn;

Convert string {expr} 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" is ignored, and when {base} is 2 a leading "0b" or "0B" is ignored. Text after the number is silently ignored. Can also be used as a |method|: GetText()->str2nr()

Parameters

denops: Denops
expr: unknown
optional
base: unknown
optional
quoted: unknown

Returns

Promise<unknown>