本文整理匯總了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(', ')));