本文整理汇总了C#中Rhino.Context.GetLocale方法的典型用法代码示例。如果您正苦于以下问题:C# Context.GetLocale方法的具体用法?C# Context.GetLocale怎么用?C# Context.GetLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Context
的用法示例。
在下文中一共展示了Context.GetLocale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecIdCall
//.........这里部分代码省略.........
{
return Tagify(thisObj, "sub", null, null);
}
case Id_fontsize:
{
return Tagify(thisObj, "font", "size", args);
}
case Id_fontcolor:
{
return Tagify(thisObj, "font", "color", args);
}
case Id_link:
{
return Tagify(thisObj, "a", "href", args);
}
case Id_anchor:
{
return Tagify(thisObj, "a", "name", args);
}
case Id_equals:
case Id_equalsIgnoreCase:
{
string s1 = ScriptRuntime.ToString(thisObj);
string s2 = ScriptRuntime.ToString(args, 0);
return ScriptRuntime.WrapBoolean((id == Id_equals) ? s1.Equals(s2) : Sharpen.Runtime.EqualsIgnoreCase(s1, s2));
}
case Id_match:
case Id_search:
case Id_replace:
{
int actionType;
if (id == Id_match)
{
actionType = RegExpProxyConstants.RA_MATCH;
}
else
{
if (id == Id_search)
{
actionType = RegExpProxyConstants.RA_SEARCH;
}
else
{
actionType = RegExpProxyConstants.RA_REPLACE;
}
}
return ScriptRuntime.CheckRegExpProxy(cx).Action(cx, scope, thisObj, args, actionType);
}
case Id_localeCompare:
{
// ECMA-262 1 5.5.4.9
// For now, create and configure a collator instance. I can't
// actually imagine that this'd be slower than caching them
// a la ClassCache, so we aren't trying to outsmart ourselves
// with a caching mechanism for now.
Collator collator = Collator.GetInstance(cx.GetLocale());
collator.SetStrength(Collator.IDENTICAL);
collator.SetDecomposition(Collator.CANONICAL_DECOMPOSITION);
return ScriptRuntime.WrapNumber(collator.Compare(ScriptRuntime.ToString(thisObj), ScriptRuntime.ToString(args, 0)));
}
case Id_toLocaleLowerCase:
{
return ScriptRuntime.ToString(thisObj).ToLower(cx.GetLocale());
}
case Id_toLocaleUpperCase:
{
return ScriptRuntime.ToString(thisObj).ToUpper(cx.GetLocale());
}
case Id_trim:
{
string str = ScriptRuntime.ToString(thisObj);
char[] chars = str.ToCharArray();
int start = 0;
while (start < chars.Length && ScriptRuntime.IsJSWhitespaceOrLineTerminator(chars[start]))
{
start++;
}
int end = chars.Length;
while (end > start && ScriptRuntime.IsJSWhitespaceOrLineTerminator(chars[end - 1]))
{
end--;
}
return Sharpen.Runtime.Substring(str, start, end);
}
}
throw new ArgumentException(id.ToString());
again_continue: ;
}
again_break: ;
}