当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript StringWrapper.replace方法代码示例

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


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

示例1: _extractUnscopedRulesFromCssText

 _extractUnscopedRulesFromCssText(cssText) {
   var r = '',
       m;
   var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText);
   while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
     var rule = m[0];
     rule = StringWrapper.replace(rule, m[2], '');
     rule = StringWrapper.replace(rule, m[1], m[3]);
     r = rule + '\n\n';
   }
   return r;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:12,代码来源:shadow_css.ts

示例2: _extractUnscopedRulesFromCssText

 /*
  * Process styles to add rules which will only apply under the polyfill
  * and do not process via CSSOM. (CSSOM is destructive to rules on rare
  * occasions, e.g. -webkit-calc on Safari.)
  * For example, we convert this rule:
  *
  * @polyfill-unscoped-rule {
  *   content: 'menu-item';
  * ... }
  *
  * to this:
  *
  * menu-item {...}
  *
 **/
 _extractUnscopedRulesFromCssText(cssText: string): string {
   // Difference with webcomponents.js: does not handle comments
   var r = '', m;
   var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText);
   while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
     var rule = m[0];
     rule = StringWrapper.replace(rule, m[2], '');
     rule = StringWrapper.replace(rule, m[1], m[3]);
     r = rule + '\n\n';
   }
   return r;
 }
开发者ID:188799958,项目名称:angular,代码行数:27,代码来源:shadow_css.ts

示例3: _applySimpleSelectorScope

 _applySimpleSelectorScope(selector, scopeSelector, hostSelector) {
   if (isPresent(RegExpWrapper.firstMatch(_polyfillHostRe, selector))) {
     var replaceBy = this.strictStyling ? `[${hostSelector}]` : scopeSelector;
     selector = StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy);
     return StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' ');
   } else {
     return scopeSelector + ' ' + selector;
   }
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:shadow_css.ts

示例4: transform

  transform(value: any, args: any[]): any {
    if (isBlank(args) || args.length !== 2) {
      throw new BaseException('ReplacePipe requires two arguments');
    }

    if (isBlank(value)) {
      return value;
    }

    if (!this._supportedInput(value)) {
      throw new InvalidPipeArgumentException(ReplacePipe, value);
    }

    var input = value.toString();
    var pattern = args[0];
    var replacement = args[1];


    if (!this._supportedPattern(pattern)) {
      throw new InvalidPipeArgumentException(ReplacePipe, pattern);
    }
    if (!this._supportedReplacement(replacement)) {
      throw new InvalidPipeArgumentException(ReplacePipe, replacement);
    }
    // template fails with literal RegExp e.g /pattern/igm
    // var rgx = pattern instanceof RegExp ? pattern : RegExpWrapper.create(pattern);

    if (isFunction(replacement)) {
      var rgxPattern = isString(pattern) ? RegExpWrapper.create(pattern) : pattern;

      return StringWrapper.replaceAllMapped(input, rgxPattern, replacement);
    }
    if (pattern instanceof RegExp) {
      // use the replaceAll variant
      return StringWrapper.replaceAll(input, pattern, replacement);
    }

    return StringWrapper.replace(input, pattern, replacement);
  }
开发者ID:LordBinary,项目名称:angular,代码行数:39,代码来源:replace_pipe.ts

示例5: _colonHostPartReplacer

 _colonHostPartReplacer(host, part, suffix) {
   return host + StringWrapper.replace(part, _polyfillHost, '') + suffix;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:3,代码来源:shadow_css.ts

示例6: function

 return StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) {
   var rule = m[0];
   rule = StringWrapper.replace(rule, m[1], '');
   rule = StringWrapper.replace(rule, m[2], '');
   return m[3] + rule;
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:6,代码来源:shadow_css.ts

示例7: normalize

 function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); }
开发者ID:B-Thapa,项目名称:angular,代码行数:1,代码来源:json_pipe_spec.ts


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