当前位置: 首页>>代码示例>>C#>>正文


C# Globalization.CompareInfo类代码示例

本文整理汇总了C#中System.Globalization.CompareInfo的典型用法代码示例。如果您正苦于以下问题:C# CompareInfo类的具体用法?C# CompareInfo怎么用?C# CompareInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompareInfo类属于System.Globalization命名空间,在下文中一共展示了CompareInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CultureComparer

 //--- Constructors ---
 /// <summary>
 /// Create comparer based on culture.
 /// </summary>
 /// <param name="culture">Culture to get <see cref="CompareInfo"/> from.</param>
 public CultureComparer(CultureInfo culture)
 {
     if(culture == null) {
         throw new ArgumentNullException("culture");
     }
     _cultureCompare = culture.CompareInfo;
 }
开发者ID:bjorg,项目名称:DReAM,代码行数:12,代码来源:stringutil.cs

示例2: Comparer

		Comparer (CultureInfo culture)
		{
			if (culture == null)
				throw new ArgumentNullException ("culture");

			m_compareInfo = culture.CompareInfo;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:Comparer.cs

示例3: Comparer

 public Comparer(CultureInfo culture) {
     if (culture==null) {
         throw new ArgumentNullException("culture");
     }
     Contract.EndContractBlock();
     m_compareInfo = culture.CompareInfo;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:7,代码来源:comparer.cs

示例4: CharacterTest

 public CharacterTest()
 {
     _MarvelPublicKey = "67d146c4c462f0b55bf12bb7d60948af";
     _MarvelPrivateKey = "54fd1a8ac788767cc91938bcb96755186074970b";
     _Marvel = new Marvel(_MarvelPublicKey, _MarvelPrivateKey);
     _Comparer = CompareInfo.GetCompareInfo("en-US");
 }
开发者ID:gregorysl,项目名称:MarvelAPI,代码行数:7,代码来源:CharacterTest.cs

示例5: DeclareCollation

        /// <summary>
        /// Create a collation based on a given <c>CompareInfo</c> and <c>CompareOptions</c>    
        /// </summary>
        /// <param name="uri">The collation URI to be used within the XPath expression to refer to this collation</param>
        /// <param name="comparer">The <c>CompareInfo</c>, which determines the language-specific
        /// collation rules to be used</param>
        /// <param name="options">Options to be used in performing comparisons, for example
        /// whether they are to be case-blind and/or accent-blind</param>
        /// <param name="isDefault">If true, this collation will be used as the default collation</param>

        public void DeclareCollation(Uri uri, CompareInfo compareInfo, CompareOptions options, Boolean isDefault) {
            DotNetComparator comparator = new DotNetComparator(compareInfo, options);
            env.declareCollation(uri.ToString(), comparator);
            if(isDefault) {
                env.declareDefaultCollation(uri.ToString());
            }
        }
开发者ID:nuxleus,项目名称:saxonica,代码行数:17,代码来源:XQuery.cs

示例6: LinearIndexOf

 private int LinearIndexOf(string fieldName, CompareOptions compareOptions)
 {
     CompareInfo compareInfo = this._compareInfo;
     if (compareInfo == null)
     {
         if (-1 != this._defaultLocaleID)
         {
             compareInfo = CompareInfo.GetCompareInfo(this._defaultLocaleID);
         }
         if (compareInfo == null)
         {
             compareInfo = CultureInfo.InvariantCulture.CompareInfo;
         }
         this._compareInfo = compareInfo;
     }
     int length = this._fieldNames.Length;
     for (int i = 0; i < length; i++)
     {
         if (compareInfo.Compare(fieldName, this._fieldNames[i], compareOptions) == 0)
         {
             this._fieldNameLookup[fieldName] = i;
             return i;
         }
     }
     return -1;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:FieldNameLookup.cs

示例7: PatternMatcher

        /// <summary>
        /// Construct a new PatternMatcher using the specified culture.
        /// </summary>
        /// <param name="pattern">The pattern to make the pattern matcher for.</param>
        /// <param name="culture">The culture to use for string searching and comparison.</param>
        /// <param name="verbatimIdentifierPrefixIsWordCharacter">Whether to consider "@" as a word character</param>
        /// <param name="allowFuzzyMatching">Whether or not close matches should count as matches.</param>
        public PatternMatcher(
            string pattern,
            CultureInfo culture,
            bool verbatimIdentifierPrefixIsWordCharacter,
            bool allowFuzzyMatching)
        {
            pattern = pattern.Trim();
            _compareInfo = culture.CompareInfo;
            _allowFuzzyMatching = allowFuzzyMatching;

            _fullPatternSegment = new Segment(pattern, verbatimIdentifierPrefixIsWordCharacter, allowFuzzyMatching);

            if (pattern.IndexOf('.') < 0)
            {
                // PERF: Avoid string.Split allocations when the pattern doesn't contain a dot.
                _dotSeparatedSegments = pattern.Length > 0
                    ? new Segment[1] { _fullPatternSegment }
                    : Array.Empty<Segment>();
            }
            else
            {
                _dotSeparatedSegments = pattern.Split(s_dotCharacterArray, StringSplitOptions.RemoveEmptyEntries)
                                                .Select(text => new Segment(text.Trim(), verbatimIdentifierPrefixIsWordCharacter, allowFuzzyMatching))
                                                .ToArray();
            }

            _invalidPattern = _dotSeparatedSegments.Length == 0 || _dotSeparatedSegments.Any(s => s.IsInvalid);
        }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:35,代码来源:PatternMatcher.cs

示例8: CaseInsensitiveComparer

 public CaseInsensitiveComparer(CultureInfo culture)
 {
     if (culture == null)
     {
         throw new ArgumentNullException("culture");
     }
     this.m_compareInfo = culture.CompareInfo;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:8,代码来源:CaseInsensitiveComparer.cs

示例9: CaseInsensitiveHashCodeProvider

 public CaseInsensitiveHashCodeProvider(CultureInfo culture)
 {
     if (culture == null)
     {
         throw new ArgumentNullException(nameof(culture));
     }
     _compareInfo = culture.CompareInfo;
 }
开发者ID:Corillian,项目名称:corefx,代码行数:8,代码来源:CaseInsensitiveHashCodeProvider.cs

示例10: CaseInsensitiveComparer

 public CaseInsensitiveComparer(CultureInfo culture)
 {
     if (culture == null)
     {
         throw new ArgumentNullException(nameof(culture));
     }
     Contract.EndContractBlock();
     _compareInfo = culture.CompareInfo;
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:9,代码来源:CaseInsensitiveComparer.cs

示例11: AssertCompare

	void AssertCompare (string message, int result, string s1, string s2,
		CompareOptions opt, CompareInfo ci)
	{
		int ret = ci.Compare (s1, s2, opt);
		if (result == 0)
			AssertEquals (message, 0, ret);
		else if (result < 0)
			Assert.IsTrue (message + String.Format ("(neg: {0})", ret), ret < 0);
		else
			Assert.IsTrue (message + String.Format ("(pos: {0})", ret), ret > 0);
	}
开发者ID:carrie901,项目名称:mono,代码行数:11,代码来源:CompareInfoTest.jvm.cs

示例12: Comparer

 private Comparer(SerializationInfo info, StreamingContext context)
 {
     this.m_compareInfo = null;
     SerializationInfoEnumerator enumerator = info.GetEnumerator();
     while (enumerator.MoveNext())
     {
         string str;
         if (((str = enumerator.Name) != null) && (str == "CompareInfo"))
         {
             this.m_compareInfo = (CompareInfo) info.GetValue("CompareInfo", typeof(CompareInfo));
         }
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:13,代码来源:Comparer.cs

示例13: __DTString

		internal __DTString(string str, DateTimeFormatInfo dtfi)
		{
			this.Index = -1;
			this.Value = str;
			this.len = this.Value.Length;
			this.m_current = '\0';
			if (dtfi != null)
			{
				this.m_info = dtfi.CompareInfo;
				this.m_checkDigitToken = ((dtfi.FormatFlags & DateTimeFormatFlags.UseDigitPrefixInTokens) != DateTimeFormatFlags.None);
				return;
			}
			this.m_info = Thread.CurrentThread.CurrentCulture.CompareInfo;
			this.m_checkDigitToken = false;
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:15,代码来源:__DTString.cs

示例14: MatchCaseInsensitive

 /// <summary>
 /// Attempts to match the specified string with the current point in the string in a case-insensitive
 /// manner, according to the given comparison info.
 /// </summary>
 internal bool MatchCaseInsensitive(string match, CompareInfo compareInfo)
 {
     unchecked
     {
         if (match.Length > Value.Length - Index)
         {
             return false;
         }
         // FIXME: This will fail if the length in the input string is different to the length in the
         // match string for culture-specific reasons. It's not clear how to handle that...
         if (compareInfo.Compare(Value, Index, match.Length, match, 0, match.Length, CompareOptions.IgnoreCase) == 0)
         {
             Move(Index + match.Length);
             return true;
         }
         return false;
     }
 }
开发者ID:manirana007,项目名称:NodaTime,代码行数:22,代码来源:ValueCursor.cs

示例15: Compare

        internal int Compare(string s1, string s2, CompareInfo comparer) {
            object obj1 = s1;
            object obj2 = s2;
            if (obj1 == obj2)
                return 0;
            if (obj1 == null)
                return -1;
            if (obj2 == null)
                return 1;

            int leng1 = s1.Length;
            int leng2 = s2.Length;

            for (; leng1 > 0; leng1--) {
                if (s1[leng1-1] != 0x20 && s1[leng1-1] != 0x3000) // 0x3000 is Ideographic Whitespace
                    break;
            }
            for (; leng2 > 0; leng2--) {
                if (s2[leng2-1] != 0x20 && s2[leng2-1] != 0x3000)
                    break;
            }

            return (comparer ?? this.CompareInfo).Compare(s1, 0, leng1, s2, 0, leng2, _compareFlags);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:24,代码来源:DataTable.cs


注:本文中的System.Globalization.CompareInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。