本文整理汇总了C#中System.String.Isi方法的典型用法代码示例。如果您正苦于以下问题:C# String.Isi方法的具体用法?C# String.Isi怎么用?C# String.Isi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.String
的用法示例。
在下文中一共展示了String.Isi方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Suggest
/// <summary>
/// Suggests the initial Encoding for the given locale.
/// </summary>
/// <param name="locale">
/// The locale defined by the BCP 47 language tag.
/// </param>
/// <returns>The suggested encoding.</returns>
public Encoding Suggest(String locale)
{
if (!String.IsNullOrEmpty(locale) && locale.Length > 1)
{
var encoding = default(Encoding);
if (suggestions.TryGetValue(locale.Substring(0, 2), out encoding))
return encoding;
else if (locale.Isi("zh-cn"))
return TextEncoding.Gb18030;
else if (locale.Isi("zh-tw"))
return TextEncoding.Big5;
}
return TextEncoding.Windows1252;
}
示例2: GetContext
/// <summary>
/// Gets the drawing context.
/// </summary>
/// <param name="contextId">A context id like 2d.</param>
/// <returns>An object that defines the drawing context.</returns>
public IRenderingContext GetContext(String contextId)
{
if (_current == null || contextId.Isi(_current.ContextId))
{
var renderServices = Owner.Options.GetServices<IRenderingService>();
foreach (var renderService in renderServices)
{
if (renderService.IsSupportingContext(contextId))
{
var context = renderService.CreateContext(this, contextId);
if (context != null)
{
_mode = GetModeFrom(contextId);
_current = context;
}
return context;
}
}
return null;
}
return _current;
}
示例3: CreateBody
public static Stream CreateBody(this FormDataSet formDataSet, String enctype, Encoding encoding)
{
if (enctype.Isi(MimeTypeNames.UrlencodedForm))
{
return formDataSet.AsUrlEncoded(encoding);
}
else if (enctype.Isi(MimeTypeNames.MultipartForm))
{
return formDataSet.AsMultipart(encoding);
}
else if (enctype.Isi(MimeTypeNames.Plain))
{
return formDataSet.AsPlaintext(encoding);
}
else if (enctype.Isi(MimeTypeNames.ApplicationJson))
{
return formDataSet.AsJson();
}
return MemoryStream.Null;
}
示例4: GetContext
/// <summary>
/// Gets the drawing context.
/// </summary>
/// <param name="contextId">A context id like 2d.</param>
/// <returns>An object that defines the drawing context.</returns>
public IRenderingContext GetContext(String contextId)
{
if (_current != null && contextId.Isi(_current.ContextId))
return _current;
var renderService = Owner.Options.GetService<IRenderingService>();
if (renderService == null)
return null;
var context = renderService.CreateContext(this, contextId);
if (context != null)
{
_mode = GetModeFrom(contextId);
_current = context;
}
return context;
}
示例5: CheckEncType
static String CheckEncType(String encType)
{
if (encType.Isi(MimeTypeNames.Plain) || encType.Isi(MimeTypeNames.MultipartForm) || encType.Isi(MimeTypeNames.ApplicationJson))
{
return encType;
}
return MimeTypeNames.UrlencodedForm;
}
示例6: Find
public CssKeyframeRule Find(String key)
{
return _rules.OfType<CssKeyframeRule>().FirstOrDefault(m => key.Isi(m.KeyText));
}
示例7: SetProperty
public void SetProperty(String propertyName, String propertyValue, String priority = null)
{
if (IsReadOnly)
throw new DomException(DomError.NoModificationAllowed);
if (!String.IsNullOrEmpty(propertyValue))
{
if (priority == null || priority.Isi(Keywords.Important))
{
var value = _parser.ParseValue(propertyValue);
if (value != null)
{
var property = CreateProperty(propertyName);
if (property != null && property.TrySetValue(value))
{
property.IsImportant = priority != null;
SetProperty(property);
RaiseChanged();
}
}
}
}
else
{
RemoveProperty(propertyName);
}
}
示例8: SetPropertyPriority
public void SetPropertyPriority(String propertyName, String priority)
{
if (IsReadOnly)
throw new DomException(DomError.NoModificationAllowed);
if (String.IsNullOrEmpty(priority) || priority.Isi(Keywords.Important))
{
var important = !String.IsNullOrEmpty(priority);
var mappings = IsStrictMode && Factory.Properties.IsShorthand(propertyName) ?
Factory.Properties.GetLonghands(propertyName) :
Enumerable.Repeat(propertyName, 1);
foreach (var mapping in mappings)
{
var property = GetProperty(mapping);
if (property != null)
{
property.IsImportant = important;
}
}
}
}
示例9: GetModeFrom
static ContextMode GetModeFrom(String contextId)
{
if (contextId.Isi("2d"))
{
return ContextMode.Direct2d;
}
else if (contextId.Isi("webgl"))
{
return ContextMode.DirectWebGl;
}
return ContextMode.None;
}
示例10: SimpleSelector
public SimpleSelector(String match)
: this(el => match.Isi(el.LocalName), Priority.OneTag, match)
{
}
示例11: Open
/// <summary>
/// Opens a document stream for writing. For information see:
/// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-open
/// </summary>
public IDocument Open(String type = "text/html", String replace = null)
{
if (!_contentType.Is(MimeTypeNames.Html))
{
throw new DomException(DomError.InvalidState);
}
if (IsInBrowsingContext && _context.Active != this)
{
return null;
}
var shallReplace = replace.Isi(Keywords.Replace);
if (_loadingScripts.Count > 0)
{
return this;
}
if (shallReplace)
{
type = MimeTypeNames.Html;
}
var index = type.IndexOf(Symbols.Semicolon);
if (index >= 0)
{
type = type.Substring(0, index);
}
type = type.StripLeadingTrailingSpaces();
//TODO further steps needed.
//see https://html.spec.whatwg.org/multipage/webappapis.html#dom-document-open
_contentType = type;
ReplaceAll(null, false);
return this;
}
示例12: IsJavaScript
/// <summary>
/// Checks if the given mime-type is one of the JavaScript variants.
/// </summary>
/// <param name="type">The type to check for.</param>
/// <returns>
/// True if it is a legal JavaScript mime-type, otherwise false.
/// </returns>
public static Boolean IsJavaScript(String type)
{
foreach (var commonJsType in commonJsTypes)
{
if (type.Isi(commonJsType))
{
return true;
}
}
return false;
}