本文整理汇总了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');
}
示例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;
}
示例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;
}
示例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;
});
示例5: visitLiteralPrimitive
visitLiteralPrimitive(ast: LiteralPrimitive) {
if (StringWrapper.isString(ast.value)) {
this._expression += `"${StringWrapper.replaceAll(ast.value, quoteRegExp, '\"')}"`;
} else {
this._expression += `${ast.value}`;
}
}
示例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;
}
}
示例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;
}
示例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);
示例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);
}
示例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;
});