Skip to main content
Module

x/denops_std/function/mod.ts>strridx

📚 Standard module for denops.vim
Go to Latest
function strridx
import { strridx } from "https://deno.land/x/denops_std@v3.11.1/function/mod.ts";

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>