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


TypeScript StringWrapper.replaceAll方法代码示例

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


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

示例1: _makeScopeMatcher

 _makeScopeMatcher(scopeSelector) {
   var lre = RegExpWrapper.create('\\[');
   var rre = RegExpWrapper.create('\\]');
   scopeSelector = StringWrapper.replaceAll(scopeSelector, lre, '\\[');
   scopeSelector = StringWrapper.replaceAll(scopeSelector, rre, '\\]');
   return RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:shadow_css.ts

示例2: normalizeCSS

export function normalizeCSS(css: string): string {
  css = StringWrapper.replaceAll(css, RegExpWrapper.create('\\s+'), ' ');
  css = StringWrapper.replaceAll(css, RegExpWrapper.create(':\\s'), ':');
  css = StringWrapper.replaceAll(css, RegExpWrapper.create("\\'"), '"');
  css = StringWrapper.replaceAllMapped(css, RegExpWrapper.create('url\\(\\"(.+)\\"\\)'),
                                       (match) => `url(${match[1]})`);
  css = StringWrapper.replaceAllMapped(css, RegExpWrapper.create('\\[(.+)=([^"\\]]+)\\]'),
                                       (match) => `[${match[1]}="${match[2]}"]`);
  return css;
}
开发者ID:AsherBarak,项目名称:angular,代码行数:10,代码来源:utils.ts

示例3: _propertiesFromRule

 _propertiesFromRule(rule): string {
   var cssText = rule.style.cssText;
   // TODO(sorvell): Safari cssom incorrectly removes quotes from the content
   // property. (https://bugs.webkit.org/show_bug.cgi?id=118045)
   // don't replace attr rules
   var attrRe = RegExpWrapper.create('[\'"]+|attr');
   if (rule.style.content.length > 0 &&
       !isPresent(RegExpWrapper.firstMatch(attrRe, rule.style.content))) {
     var contentRe = RegExpWrapper.create('content:[^;]*;');
     cssText =
         StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';');
   }
   // TODO(sorvell): we can workaround this issue here, but we need a list
   // of troublesome properties to fix https://github.com/Polymer/platform/issues/53
   //
   // inherit rules can be omitted from cssText
   // TODO(sorvell): remove when Blink bug is fixed:
   // https://code.google.com/p/chromium/issues/detail?id=358273
   // var style = rule.style;
   // for (var i = 0; i < style.length; i++) {
   //  var name = style.item(i);
   //  var value = style.getPropertyValue(name);
   //  if (value == 'initial') {
   //    cssText += name + ': initial; ';
   //  }
   //}
   return cssText;
 }
开发者ID:188799958,项目名称:angular,代码行数:28,代码来源:shadow_css.ts

示例4:

 return StringWrapper.replaceAllMapped(cssText, re, (m) => {
   var pre = m[1];
   var url = StringWrapper.replaceAll(m[2], _quoteRe, '');
   var post = m[3];
   var resolvedUrl = this._resolver.resolve(baseUrl, url);
   return pre + "'" + resolvedUrl + "'" + post;
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:style_url_resolver.ts

示例5: visitLiteralPrimitive

 visitLiteralPrimitive(ast: LiteralPrimitive) {
   if (StringWrapper.isString(ast.value)) {
     this._expression += `"${StringWrapper.replaceAll(ast.value, quoteRegExp, '\"')}"`;
   } else {
     this._expression += `${ast.value}`;
   }
 }
开发者ID:B-Thapa,项目名称:angular,代码行数:7,代码来源:unparser.ts

示例6: _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

示例7: _propertiesFromRule

 _propertiesFromRule(rule) {
   var cssText = rule.style.cssText;
   var attrRe = RegExpWrapper.create('[\'"]+|attr');
   if (rule.style.content.length > 0 && !isPresent(RegExpWrapper.firstMatch(attrRe, rule.style.content))) {
     var contentRe = RegExpWrapper.create('content:[^;]*;');
     cssText = StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';');
   }
   return cssText;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:shadow_css.ts

示例8: function

 scoped = ListWrapper.map(parts, function(p) {
   var t = StringWrapper.replaceAll(p.trim(), _polyfillHostRe, '');
   if (t.length > 0 && !ListWrapper.contains(splits, t) && !StringWrapper.contains(t, attrName)) {
     var re = RegExpWrapper.create('([^:]*)(:*)(.*)');
     var m = RegExpWrapper.firstMatch(re, t);
     if (isPresent(m)) {
       p = m[1] + attrName + m[2] + m[3];
     }
   }
   return p;
 }).join(sep);
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:11,代码来源:shadow_css.ts

示例9: transform

  transform(value: number, pluralMap: {[count: string]: string}): string {
    var key: string;
    var valueStr: string;

    if (!isStringMap(pluralMap)) {
      throw new InvalidPipeArgumentException(I18nPluralPipe, pluralMap);
    }

    key = value === 0 || value === 1 ? `=${value}` : 'other';
    valueStr = isPresent(value) ? value.toString() : '';

    return StringWrapper.replaceAll(pluralMap[key], interpolationExp, valueStr);
  }
开发者ID:844496869,项目名称:angular,代码行数:13,代码来源:i18n_plural_pipe.ts

示例10:

    return StringWrapper.replaceAllMapped(cssText, re, (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 = this._resolver.resolve(baseUrl, url);

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


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