import { Tuple } from '../../primitive/Tuple'; import { Push } from '../../array/Push'; import { Length } from '../../array/Length'; import { StartsWith } from '../StartWith'; import { If } from '../../commonness/If'; /** * * Type to find the last index of a substring in a string * * 문자열에서 특정 부분 문자열의 마지막 인덱스를 찾는 타입 * * @param T String to search in / 검색할 문자열 * * @param U Substring to find / 찾을 부분 문자열 * * @returns Last index of the substring, -1 if not found / 부분 문자열의 마지막 인덱스, 찾지 못한 경우 -1 * * @example * type cases = [ * Expect, 0>>, * Expect, 3>>, * Expect, 4>>, * Expect, -1>>, * ] * * @link https://www.utilscript.site/docs/usage-string/last-index-of * */ export type LastIndexOf = T extends `${infer Current}${infer Rest}` ? If, LastIndexOf, Length>, LastIndexOf, R>> : R;