本文整理汇总了TypeScript中@jonggrang/parsing.string函数的典型用法代码示例。如果您正苦于以下问题:TypeScript string函数的具体用法?TypeScript string怎么用?TypeScript string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了string函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Date
const rfc1123Date: PS.Parser<HttpDate> = PS.co(function *() {
yield PS.optional(weekDay.chain(() => PS.string(', ')));
const [y, m, d]: [number, Month, Day] = yield date;
yield PS.optional(PS.whiteSpace);
const [h, n, s]: [number, number, number] = yield time;
yield PS.optional(PS.whiteSpace);
// RFC 2616 defines GMT only but there are actually ill-formed ones such
// as "+0000" and "UTC" in the wild.
yield PS.string('GMT').alt(PS.string('+0000')).alt(PS.string('UTC'));
return PS.pure(fromDate(new Date(Date.UTC(y, m, d, h, n, s))));
});
示例2: optNH4cH4
)).alt(PS.attempt(PS.co(function* () {
const a1: string = yield optNH4cH4(0);
yield PS.string('::');
const a2: string = yield countP(4, h4c).map(arrjoinStr);
const a3: string = yield ls32;
return PS.pure(`${a1}::${a2}${a3}`);
}))).alt(PS.attempt(PS.co(function* () {
示例3:
const hierPart: PS.Parser<[Maybe<URIAuth>, string]> = PS.co(function* () {
yield PS.attempt(PS.string('//'));
const ua: Maybe<URIAuth> = yield uauthority;
const up: string = yield pathAbEmpty;
return PS.pure([ua, up]);
})
示例4:
yield PS.optional(weekDay.chain(() => PS.string(', ')));