Skip to main content
Module

x/ddc_vim/deps.ts>fn.strcasestr

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

Vim doesn't have a strcasestr() function. But you can add "\c" to the pattern to ignore case: :let idx = match(haystack, '\cneedle') If {start} is given, the search starts from byte index {start} in a String or item {start} in a |List|. The result, however, is still the index counted from the first character/item. Example: :echo match("testing", "ing", 2) result is again "4". :echo match("testing", "ing", 4) result is again "4". :echo match("testing", "t", 2) result is "3". For a String, if {start} > 0 then it is like the string starts {start} bytes later, thus "^" will match at {start}. Except when {count} is given, then it's like matches before the {start} byte are ignored (this is a bit complicated to keep it backwards compatible). For a String, if {start} < 0, it will be set to 0. For a list the index is counted from the end. If {start} is out of range ({start} > strlen({expr}) for a String or {start} > len({expr}) for a |List|) -1 is returned. When {count} is given use the {count}'th match. When a match is found in a String the search for the next one starts one character further. Thus this example results in 1: echo match("testing", "..", 0, 2) In a |List| the search continues in the next item. Note that when {count} is added the way {start} works changes, see above. See |pattern| for the patterns that are accepted. The 'ignorecase' option is used to set the ignore-caseness of the pattern. 'smartcase' is NOT used. The matching is always done like 'magic' is set and 'cpoptions' is empty. Note that a match at the start is preferred, thus when the pattern is using "*" (any number of matches) it tends to find zero matches at the start instead of a number of matches further down in the text. Can also be used as a |method|: GetList()->match('word')

Returns

Promise<unknown>