lastIndexOfOr
ts
function String.lastIndexOfOr<T>(
target: string,
source: string,
or: T,
): number | TReturns the index of the last occurrence of source string in target string, or the or value if not found.
Example
ts
import { String } from "@monstermann/string";
String.lastIndexOfOr("hello world hello", "hello", -1); // 12
String.lastIndexOfOr("hello world", "foo", -1); // -1ts
import { String } from "@monstermann/string";
pipe("hello world hello", String.lastIndexOfOr("hello", -1)); // 12
pipe("hello world", String.lastIndexOfOr("foo", -1)); // -1