• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript lang.RegExpWrapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中angular2/src/core/facade/lang.RegExpWrapper的典型用法代码示例。如果您正苦于以下问题:TypeScript RegExpWrapper类的具体用法?TypeScript RegExpWrapper怎么用?TypeScript RegExpWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了RegExpWrapper类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: it

 it('should reset before it is reused', () => {
   var re = /^['"]/g;
   var str = "'";
   expect(RegExpWrapper.test(re, str)).toEqual(true);
   // If not reset, the second attempt to test results in false
   expect(RegExpWrapper.test(re, str)).toEqual(true);
 });
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:lang_spec.ts


示例2: _format

 static _format(value: number, style: NumberFormatStyle, digits: string, currency: string = null,
                currencyAsSymbol: boolean = false): string {
   if (isBlank(value)) return null;
   if (!isNumber(value)) {
     throw new InvalidPipeArgumentException(NumberPipe, value);
   }
   var minInt = 1, minFraction = 0, maxFraction = 3;
   if (isPresent(digits)) {
     var parts = RegExpWrapper.firstMatch(_re, digits);
     if (isBlank(parts)) {
       throw new BaseException(`${digits} is not a valid digit info for number pipes`);
     }
     if (isPresent(parts[1])) {  // min integer digits
       minInt = NumberWrapper.parseIntAutoRadix(parts[1]);
     }
     if (isPresent(parts[3])) {  // min fraction digits
       minFraction = NumberWrapper.parseIntAutoRadix(parts[3]);
     }
     if (isPresent(parts[5])) {  // max fraction digits
       maxFraction = NumberWrapper.parseIntAutoRadix(parts[5]);
     }
   }
   return NumberFormatter.format(value, defaultLocale, style, {
     minimumIntegerDigits: minInt,
     minimumFractionDigits: minFraction,
     maximumFractionDigits: maxFraction,
     currency: currency,
     currencyAsSymbol: currencyAsSymbol
   });
 }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:30,代码来源:number_pipe.ts


示例3: isPresent

 return StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m) => {
   var url = isPresent(m[1]) ? m[1] : m[2];
   var schemeMatch = RegExpWrapper.firstMatch(_urlWithSchemaRe, url);
   if (isPresent(schemeMatch) && schemeMatch[1] != 'package') {
     // Do not attempt to resolve non-package absolute URLs with URI scheme
     return m[0];
   }
   foundUrls.push(resolver.resolve(baseUrl, url));
   return '';
 });
开发者ID:jianliao,项目名称:angular-upgrade-demo,代码行数:10,代码来源:style_url_resolver.ts


示例4:

  return StringWrapper.replaceAllMapped(cssText, _cssUrlRe, (m) => {
    var pre = m[1];
    var originalUrl = m[2];
    if (RegExpWrapper.test(_dataUrlRe, originalUrl)) {
      // Do not attempt to resolve data: URLs
      return m[0];
    }
    var url = StringWrapper.replaceAll(originalUrl, _quoteRe, '');
    var post = m[3];

    var resolvedUrl = resolver.resolve(baseUrl, url);

    return pre + "'" + resolvedUrl + "'" + post;
  });
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:14,代码来源:style_url_resolver.ts


示例5: it

 it('should write all data into a file', inject([AsyncTestCompleter], (async) => {
      createReporter({
        sampleId: 'someId',
        descriptions: [{'a': 2}],
        path: 'somePath',
        metrics: {'script': 'script time'}
      })
          .reportSample([mv(0, 0, {'a': 3, 'b': 6})],
                        [mv(0, 0, {'a': 3, 'b': 6}), mv(1, 1, {'a': 5, 'b': 9})]);
      var regExp = /somePath\/someId_\d+\.json/g;
      expect(isPresent(RegExpWrapper.firstMatch(regExp, loggedFile['filename']))).toBe(true);
      var parsedContent = Json.parse(loggedFile['content']);
      expect(parsedContent)
          .toEqual({
            "description":
                {"id": "someId", "description": {"a": 2}, "metrics": {"script": "script time"}},
            "completeSample": [
              {
                "timeStamp": "1970-01-01T00:00:00.000Z",
                "runIndex": 0,
                "values": {"a": 3, "b": 6}
              }
            ],
            "validSample": [
              {
                "timeStamp": "1970-01-01T00:00:00.000Z",
                "runIndex": 0,
                "values": {"a": 3, "b": 6}
              },
              {
                "timeStamp": "1970-01-01T00:00:00.001Z",
                "runIndex": 1,
                "values": {"a": 5, "b": 9}
              }
            ]
          });
      async.done();
    }));
开发者ID:hankduan,项目名称:angular,代码行数:38,代码来源:json_file_reporter_spec.ts


示例6: _split

/**
 * Splits a URI into its component parts.
 *
 * Each component can be accessed via the component indices; for example:
 * <pre>
 * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA];
 * </pre>
 *
 * @param {string} uri The URI string to examine.
 * @return {!Array.<string|undefined>} Each component still URI-encoded.
 *     Each component that is present will contain the encoded value, whereas
 *     components that are not present will be undefined or empty, depending
 *     on the browser's regular expression implementation.  Never null, since
 *     arbitrary strings may still look like path names.
 */
function _split(uri: string): Array<string | any> {
  return RegExpWrapper.firstMatch(_splitRe, uri);
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:18,代码来源:url_resolver.ts


示例7:

 *    $6 = <undefined>       query without ?
 *    $7 = Related           fragment without #
 * </pre>
 * @type {!RegExp}
 * @private
 */
var _splitRe =
    RegExpWrapper.create('^' +
                         '(?:' +
                         '([^:/?#.]+)' +  // scheme - ignore special characters
                                          // used by other URL parts such as :,
                                          // ?, /, #, and .
                         ':)?' +
                         '(?://' +
                         '(?:([^/?#]*)@)?' +                  // userInfo
                         '([\\w\\d\\-\\u0100-\\uffff.%]*)' +  // domain - restrict to letters,
                                                              // digits, dashes, dots, percent
                                                              // escapes, and unicode characters.
                         '(?::([0-9]+))?' +                   // port
                         ')?' +
                         '([^?#]+)?' +        // path
                         '(?:\\?([^#]*))?' +  // query
                         '(?:#(.*))?' +       // fragment
                         '$');

/**
 * The index of each URI component in the return value of goog.uri.utils.split.
 * @enum {number}
 */
enum _ComponentIndex {
  Scheme = 1,
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:31,代码来源:url_resolver.ts


示例8: it

 it('should handle -webkit-keyframes rules', () => {
   var css = '@-webkit-keyframes foo {0% {-webkit-transform: translate(-50%) scaleX(0);}}';
   var passRe =
       /@-webkit-keyframes foo {\s*0% {\s*(-webkit-)*transform:translate\(-50%\) scaleX\(0\);\s*}}/g;
   expect(RegExpWrapper.test(passRe, s(css, 'a'))).toEqual(true);
 });
开发者ID:hankduan,项目名称:angular,代码行数:6,代码来源:shadow_css_spec.ts


示例9: isStyleUrlResolvable

export function isStyleUrlResolvable(url: string): boolean {
  if (isBlank(url) || url.length === 0 || url[0] == '/') return false;
  var schemeMatch = RegExpWrapper.firstMatch(_urlWithSchemaRe, url);
  return isBlank(schemeMatch) || schemeMatch[1] == 'package';
}
开发者ID:beta3000,项目名称:hola-angular2,代码行数:5,代码来源:style_url_resolver.ts



注:本文中的angular2/src/core/facade/lang.RegExpWrapper类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript lang.StringWrapper类代码示例发布时间:2022-05-25
下一篇:
TypeScript lang.NumberWrapper类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap