|
75 | 75 | Defines the string comparison options to use with <see cref="T:System.Globalization.CompareInfo" />.
|
76 | 76 | </summary>
|
77 | 77 | <remarks>
|
78 |
| - <format type="text/markdown"> |
79 |
| - <. |
| 82 | +In .NET 5 and later, the cross-platform ICU (International Components for Unicode) library is used for string processing. The ICU library brings the following changes to string comparison behavior: |
| 83 | +
|
| 84 | +- The default option `None` is now equivalent to the `StringSort` option. The previous functionality of `None`, where equal weighting was given to alphanumeric and nonalphanumeric characters, is no longer available. |
| 85 | +- Ligatures (combined characters like "æ" and "œ") are now seen as distinct from their expanded forms ("ae", "oe") in string comparisons by default. To treat ligatures and their expanded forms as equivalent, use the `IgnoreNonSpace` option. |
| 86 | +
|
| 87 | +For more information about the change, including how to restore the previous Unicode handler, see [.NET globalization and ICU](/dotnet/core/extensions/globalization-icu). |
| 88 | +
|
| 89 | +For more information about this API, see [Supplemental API remarks for CompareOptions](/dotnet/fundamentals/runtime-libraries/system-globalization-compareoptions). |
| 90 | +
|
| 91 | +## Examples |
| 92 | +
|
| 93 | +The following code example shows how each of the CompareOptions values affect string comparisons. |
| 94 | +
|
| 95 | +:::code language="csharp" source="~/snippets/csharp/System.Globalization/CompareOptions/Overview/compareoptions_values.cs" interactive="try-dotnet"::: |
| 96 | +:::code language="fsharp" source="~/snippets/fsharp/System.Globalization/compareoptions_values.fs"::: |
| 97 | +:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CompareOptions.Values/VB/compareoptions_values.vb"::: |
| 98 | +
|
| 99 | +The following code example shows how sorting with StringSort differs from sorting without StringSort. |
| 100 | +
|
| 101 | +:::code language="csharp" source="~/snippets/csharp/System.Globalization/CompareOptions/Overview/compareoptions_stringsort.cs" interactive="try-dotnet"::: |
| 102 | +:::code language="fsharp" source="~/snippets/fsharp/System.Globalization/compareoptions_stringsort.fs"::: |
| 103 | +:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CompareOptions.StringSort/VB/compareoptions_stringsort.vb"::: |
86 | 104 |
|
87 |
| - For more information about this API, see [Supplemental API remarks for CompareOptions](/dotnet/fundamentals/runtime-libraries/system-globalization-compareoptions). |
88 | 105 | ]]></format>
|
89 | 106 | </remarks>
|
90 |
| - <example> |
91 |
| - The following code example shows how each of the CompareOptions values affect string comparisons. |
92 |
| - <format type="text/markdown"> |
93 |
| - <![CDATA[ |
94 |
| - :::code language="csharp" source="~/snippets/csharp/System.Globalization/CompareOptions/Overview/compareoptions_values.cs" interactive="try-dotnet"::: |
95 |
| - :::code language="fsharp" source="~/snippets/fsharp/System.Globalization/compareoptions_values.fs"::: |
96 |
| - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CompareOptions.Values/VB/compareoptions_values.vb" id="Snippet1"::: |
97 |
| - ]]> |
98 |
| - </format> |
99 |
| - </example> |
100 |
| - <example> |
101 |
| - The following code example shows how sorting with StringSort differs from sorting without StringSort. |
102 |
| - <format type="text/markdown"> |
103 |
| - <![CDATA[ |
104 |
| - :::code language="csharp" source="~/snippets/csharp/System.Globalization/CompareOptions/Overview/compareoptions_stringsort.cs" interactive="try-dotnet"::: |
105 |
| - :::code language="fsharp" source="~/snippets/fsharp/System.Globalization/compareoptions_stringsort.fs"::: |
106 |
| - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Globalization.CompareOptions.StringSort/VB/compareoptions_stringsort.vb" id="Snippet2"::: |
107 |
| - ]]> |
108 |
| - </format> |
109 |
| - </example> |
110 | 107 | <related type="Article" href="/dotnet/standard/base-types/basic-string-operations">Basic String Operations in .NET</related>
|
111 | 108 | </Docs>
|
112 | 109 | <Members>
|
|
0 commit comments