50. 字符串后缀判断

中等0

实现 EndsWith<T, U> ,接收两个 string 类型参数,然后判断 T 是否以 U 结尾,根据结果返回 truefalse

例如:

type a = EndsWith<'abc', 'bc'> // expected to be true
type b = EndsWith<'abc', 'abc'> // expected to be true
type c = EndsWith<'abc', 'd'> // expected to be false
评论(0)
题库

TypeScript

加载中...