本文整理汇总了C#中JsString.replace方法的典型用法代码示例。如果您正苦于以下问题:C# JsString.replace方法的具体用法?C# JsString.replace怎么用?C# JsString.replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsString
的用法示例。
在下文中一共展示了JsString.replace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parse
public JsString parse( JsString content )
{
//We need to get rid of the body element and maybe choose to do away with other things like script
var bodyRegex = new JsRegExp(@"(</?)body", "gi");
var sanitizedContent = content.replace(bodyRegex,"$1div");
return sanitizedContent;
}
示例2: loadClass
public virtual string loadClass( JsString qualifiedClassName )
{
JsRegExp classNameRegex = new JsRegExp("\\.", "g");
var potentialURL = qualifiedClassName.replace(classNameRegex, "/");
potentialURL = dynamicClassBaseUrl + potentialURL;
potentialURL += ".js";
xmlHttpRequest.open("GET", potentialURL, false);
xmlHttpRequest.send("");
//Todo Need to handle other status than just 404
if (xmlHttpRequest.status == 404) {
//Todo This alert shouldnt be here, we should figure out a way to get it to the UI level
HtmlContext.alert("Required Class " + qualifiedClassName + " cannot be loaded.");
throw new JsError("Cannot continue, missing required class " + qualifiedClassName);
}
return ( xmlHttpRequest.responseText + "\n//@ sourceURL=" + potentialURL );
}