49. 字符串前缀判断

中等0

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

例如:

type a = StartsWith<'abc', 'ac'> // expected to be false
type b = StartsWith<'abc', 'ab'> // expected to be true
type c = StartsWith<'abc', 'abcd'> // expected to be false
评论(0)
题库

TypeScript

加载中...