Skip to main content
Module

x/ddc_vim/deps.ts>fn.strridx

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

The result is a Number, which gives the byte index in {haystack} of the last occurrence of the String {needle}. When {start} is specified, matches beyond this index are ignored. This can be used to find a match before a previous match: :let lastcomma = strridx(line, ",") :let comma2 = strridx(line, ",", lastcomma - 1) The search is done case-sensitive. For pattern searches use |match()|. -1 is returned if the {needle} does not occur in {haystack}. If the {needle} is empty the length of {haystack} is returned. See also |stridx()|. Examples: :echo strridx("an angry armadillo", "an") 3 When used with a single character it works similar to the C function strrchr(). Can also be used as a |method|: GetHaystack()->strridx(needle)

Parameters

denops: Denops
haystack: unknown
needle: unknown
optional
start: unknown

Returns

Promise<unknown>