/** * * Replace a substring with another substring * * 문자열의 부분 문자열을 다른 부분 문자열로 교체하는 타입 * * @param S String / 문자열 * * @param From Substring to replace / 교체할 부분 문자열 * * @param To Substring to replace with / 교체할 부분 문자열 * * @returns Replaced string / 교체된 문자열 * * @example * type cases = [ * Expect, 'foofoo'>>, * Expect, 'foofoobar'>>, * Expect, 'foobarbar'>>, * Expect, 'foobar'>>, * Expect, 'foobarbar'>>, * Expect, ''>>, * ] * * @link https://www.utilscript.site/docs/usage-string/replace * */ export type Replace = From extends '' ? S : S extends `${infer Left}${From}${infer Right}` ? `${Left}${To}${Right}` : S;