Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddu_vim/deps.ts>fn.strridx

Dark deno-powered UI framework for neovim/Vim8
Go to Latest
function fn.strridx
import { fn } from "https://deno.land/x/ddu_vim@v1.13.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>