本文整理汇总了C#中UnicodeCategory类的典型用法代码示例。如果您正苦于以下问题:C# UnicodeCategory类的具体用法?C# UnicodeCategory怎么用?C# UnicodeCategory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnicodeCategory类属于命名空间,在下文中一共展示了UnicodeCategory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetUnicodeCategory
public void GetUnicodeCategory(string s, UnicodeCategory[] expected)
{
for (int i = 0; i < expected.Length; i++)
{
Assert.Equal(expected[i], CharUnicodeInfo.GetUnicodeCategory(s, i));
}
}
开发者ID:ESgarbi,项目名称:corefx,代码行数:7,代码来源:CharUnicodeInfoTests.cs
示例2: Charset
internal Charset(UnicodeCategory cat)
{
m_cat = cat;
for (m_generic=char.MinValue;Char.GetUnicodeCategory(m_generic)!=cat;m_generic++)
;
m_chars[m_generic] = true;
}
开发者ID:Ezakhiel,项目名称:Donate-Money-For-Unicorns-ubbse2015,代码行数:7,代码来源:lexer.cs
示例3: Filter
public static string Filter(this string value, FilterAction matchRule, UnicodeCategory categories)
{
return new string((from c in value
where matchRule == FilterAction.Keep
? categories.HasFlag(Char.GetUnicodeCategory(c))
: !categories.HasFlag(Char.GetUnicodeCategory(c))
select c).ToArray());
}
开发者ID:jonathanruisi,项目名称:Utility,代码行数:8,代码来源:ExtensionMethods.cs
示例4: OnDeserialized
private void OnDeserialized(StreamingContext ctx)
{
this.strLen = this.endIndex + 1;
this.currTextElementLen = this.nextTextElementLen;
if (this.charLen == -1)
{
this.uc = CharUnicodeInfo.InternalGetUnicodeCategory(this.str, this.index, out this.charLen);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:TextElementEnumerator.cs
示例5: YyLexer
public YyLexer(ErrorHandler eh)
{
erh = eh;
#if (GENTIME)
UsingCat(UnicodeCategory.OtherPunctuation);
m_gencat = UnicodeCategory.OtherPunctuation;
#endif
new Tfactory(this,"TOKEN",new TCreator(Tokenfactory));
}
开发者ID:Belxjander,项目名称:Asuna,代码行数:9,代码来源:lexer.cs
示例6: OnDeserialized
private void OnDeserialized(StreamingContext ctx)
{
strLen = endIndex + 1;
currTextElementLen = nextTextElementLen;
if (charLen == -1)
{
uc = CharUnicodeInfo.InternalGetUnicodeCategory(str, index, out charLen);
}
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:10,代码来源:TextElementEnumerator.cs
示例7: OnDeserialized
private void OnDeserialized(StreamingContext ctx)
{
_strLen = _endIndex + 1;
_currTextElementLen = _nextTextElementLen;
if (_charLen == -1)
{
_uc = CharUnicodeInfo.InternalGetUnicodeCategory(_str, _index, out _charLen);
}
}
开发者ID:kouvel,项目名称:coreclr,代码行数:10,代码来源:TextElementEnumerator.cs
示例8: IsLetter_Char
public static void IsLetter_Char()
{
var categories = new UnicodeCategory[]
{
UnicodeCategory.UppercaseLetter,
UnicodeCategory.LowercaseLetter,
UnicodeCategory.TitlecaseLetter,
UnicodeCategory.ModifierLetter,
UnicodeCategory.OtherLetter
};
foreach (char c in GetTestChars(categories))
Assert.True(char.IsLetter(c));
foreach (char c in GetTestCharsNotInCategory(categories))
Assert.False(char.IsLetter(c));
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:16,代码来源:CharTests.cs
示例9: IsLetterCategory
private bool IsLetterCategory(UnicodeCategory uc) {
return (uc == UnicodeCategory.UppercaseLetter
|| uc == UnicodeCategory.LowercaseLetter
|| uc == UnicodeCategory.TitlecaseLetter
|| uc == UnicodeCategory.ModifierLetter
|| uc == UnicodeCategory.OtherLetter);
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:7,代码来源:textinfo.cs
示例10: IsWordSeparator
/* false */ (0 << 29); // OtherNotAssigned = 29;
private bool IsWordSeparator(UnicodeCategory category) {
return (wordSeparatorMask & (1 << (int)category)) != 0;
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:5,代码来源:textinfo.cs
示例11: IsCombiningCategory
internal static bool IsCombiningCategory(UnicodeCategory uc) {
Contract.Assert(uc >= 0, "uc >= 0");
return (
uc == UnicodeCategory.NonSpacingMark ||
uc == UnicodeCategory.SpacingCombiningMark ||
uc == UnicodeCategory.EnclosingMark
);
}
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:8,代码来源:CharUnicodeInfo.cs
示例12: IsWhiteSpace_String_Int
public static void IsWhiteSpace_String_Int()
{
var categories = new UnicodeCategory[]
{
UnicodeCategory.SpaceSeparator,
UnicodeCategory.LineSeparator,
UnicodeCategory.ParagraphSeparator
};
foreach (char c in GetTestChars(categories))
Assert.True(char.IsWhiteSpace(c.ToString(), 0));
// Some control chars are also considered whitespace for legacy reasons.
// if ((c >= '\x0009' && c <= '\x000d') || c == '\x0085')
Assert.True(char.IsWhiteSpace("\u000b", 0));
Assert.True(char.IsWhiteSpace("\u0085", 0));
foreach (char c in GetTestCharsNotInCategory(categories))
{
// Need to special case some control chars that are treated as whitespace
if ((c >= '\x0009' && c <= '\x000d') || c == '\x0085') continue;
Assert.False(char.IsWhiteSpace(c.ToString(), 0));
}
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:23,代码来源:CharTests.cs
示例13: IsSymbol_String_Int
public static void IsSymbol_String_Int()
{
var categories = new UnicodeCategory[]
{
UnicodeCategory.MathSymbol,
UnicodeCategory.ModifierSymbol,
UnicodeCategory.CurrencySymbol,
UnicodeCategory.OtherSymbol
};
foreach (char c in GetTestChars(categories))
Assert.True(char.IsSymbol(c.ToString(), 0));
foreach (char c in GetTestCharsNotInCategory(categories))
Assert.False(char.IsSymbol(c.ToString(), 0));
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:15,代码来源:CharTests.cs
示例14: IsPunctuation_String_Int
public static void IsPunctuation_String_Int()
{
var categories = new UnicodeCategory[]
{
UnicodeCategory.ConnectorPunctuation,
UnicodeCategory.DashPunctuation,
UnicodeCategory.OpenPunctuation,
UnicodeCategory.ClosePunctuation,
UnicodeCategory.InitialQuotePunctuation,
UnicodeCategory.FinalQuotePunctuation,
UnicodeCategory.OtherPunctuation
};
foreach (char c in GetTestChars(categories))
Assert.True(char.IsPunctuation(c.ToString(), 0));
foreach (char c in GetTestCharsNotInCategory(categories))
Assert.False(char.IsPunctuation(c.ToString(), 0));
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:18,代码来源:CharTests.cs
示例15: IsLetterOrDigit_String_Int
public static void IsLetterOrDigit_String_Int()
{
var categories = new UnicodeCategory[]
{
UnicodeCategory.UppercaseLetter,
UnicodeCategory.LowercaseLetter,
UnicodeCategory.TitlecaseLetter,
UnicodeCategory.ModifierLetter,
UnicodeCategory.OtherLetter,
UnicodeCategory.DecimalDigitNumber
};
foreach (char c in GetTestChars(categories))
Assert.True(char.IsLetterOrDigit(c.ToString(), 0));
foreach (char c in GetTestCharsNotInCategory(categories))
Assert.False(char.IsLetterOrDigit(c.ToString(), 0));
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:17,代码来源:CharTests.cs
示例16: IsSeparator
static bool IsSeparator (UnicodeCategory category)
{
switch (category) {
case UnicodeCategory.SpaceSeparator:
case UnicodeCategory.LineSeparator:
case UnicodeCategory.ParagraphSeparator:
case UnicodeCategory.Control:
case UnicodeCategory.Format:
case UnicodeCategory.ConnectorPunctuation:
case UnicodeCategory.DashPunctuation:
case UnicodeCategory.OpenPunctuation:
case UnicodeCategory.ClosePunctuation:
case UnicodeCategory.InitialQuotePunctuation:
case UnicodeCategory.FinalQuotePunctuation:
case UnicodeCategory.OtherPunctuation:
return true;
}
return false;
}
开发者ID:t-ashula,项目名称:mono,代码行数:20,代码来源:TextInfo.cs
示例17: GetAllCharactersInUnicodeCategory_CategoryShouldNotContainCharacter_CategoryDoesNotContainCharacter
public void GetAllCharactersInUnicodeCategory_CategoryShouldNotContainCharacter_CategoryDoesNotContainCharacter(UnicodeCategory category, char character)
{
Assert.False(CharacterUtils.GetAllCharactersInUnicodeCategory(category).Contains(character));
}
开发者ID:regnrand,项目名称:libpalaso,代码行数:4,代码来源:CharacterUtilsTests.cs
示例18: GetAllCharactersInUnicodeCategory_CategoryShouldContainCharacter_CategoryContainsCharacter
public void GetAllCharactersInUnicodeCategory_CategoryShouldContainCharacter_CategoryContainsCharacter(UnicodeCategory category, char character)
{
Assert.True(CharacterUtils.GetAllCharactersInUnicodeCategory(category).Contains(character));
}
开发者ID:regnrand,项目名称:libpalaso,代码行数:4,代码来源:CharacterUtilsTests.cs
示例19: GetCharacterClass
static CharacterClass GetCharacterClass(UnicodeCategory c)
{
switch (c) {
case UnicodeCategory.SpaceSeparator:
case UnicodeCategory.LineSeparator:
case UnicodeCategory.ParagraphSeparator:
case UnicodeCategory.Control:
return CharacterClass.Whitespace;
case UnicodeCategory.UppercaseLetter:
case UnicodeCategory.LowercaseLetter:
case UnicodeCategory.TitlecaseLetter:
case UnicodeCategory.ModifierLetter:
case UnicodeCategory.OtherLetter:
case UnicodeCategory.DecimalDigitNumber:
return CharacterClass.IdentifierPart;
case UnicodeCategory.NonSpacingMark:
case UnicodeCategory.SpacingCombiningMark:
case UnicodeCategory.EnclosingMark:
return CharacterClass.CombiningMark;
default:
return CharacterClass.Other;
}
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:23,代码来源:TextUtilities.cs
示例20: IsCategory
private static bool IsCategory (UnicodeCategory uc, char c) {
if (Char.GetUnicodeCategory (c) == uc)
return true;
return false;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:6,代码来源:category.cs
注:本文中的UnicodeCategory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论