From 60724c2b5104c8bf5080ae36ca3b37ff00b9f692 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Fri, 1 May 2020 15:00:48 -0700 Subject: [PATCH 1/4] add rune see also links --- xml/System/Char.xml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/xml/System/Char.xml b/xml/System/Char.xml index 42f7f3d3e16..7ddde141264 100644 --- a/xml/System/Char.xml +++ b/xml/System/Char.xml @@ -423,6 +423,7 @@ When a managed type, which is represented as a Unicode UTF-16 is not a valid 21-bit Unicode code point ranging from U+0 through U+10FFFF, excluding the surrogate pair range from U+D800 through U+DFFF. + @@ -503,6 +504,7 @@ When a managed type, which is represented as a Unicode UTF-16 is not in the range U+D800 through U+DBFF, or is not in the range U+DC00 through U+DFFF. + @@ -824,6 +826,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -1021,6 +1024,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -1322,6 +1326,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -1475,6 +1480,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -1543,6 +1549,7 @@ When a managed type, which is represented as a Unicode UTF-16 is . is not a position within . + @@ -1644,6 +1651,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -1816,6 +1824,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -1966,6 +1975,8 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + + @@ -2118,6 +2129,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -2186,7 +2198,8 @@ When a managed type, which is represented as a Unicode UTF-16 is . is not a position within . - + + @@ -2270,6 +2283,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -2494,6 +2508,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -2857,6 +2872,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -2929,6 +2945,7 @@ When a managed type, which is represented as a Unicode UTF-16 is . is less than zero or greater than the last position in . + @@ -3007,6 +3024,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -3075,6 +3093,7 @@ When a managed type, which is represented as a Unicode UTF-16 is . is not a position within . + @@ -3194,6 +3213,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -3354,6 +3374,8 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + + @@ -4751,6 +4773,8 @@ This member is an explicit interface member implementation. It can be used only As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling character-casing and string-casing methods that substitute default values. Instead, you should call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. + + @@ -4878,6 +4902,7 @@ This member is an explicit interface member implementation. It can be used only ]]> + @@ -5148,6 +5173,8 @@ This member is an explicit interface member implementation. It can be used only As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling character-casing and string-casing methods that substitute default values. Instead, you should call methods that require parameters to be explicitly specified. To convert a character to uppercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. + + @@ -5274,6 +5301,7 @@ This member is an explicit interface member implementation. It can be used only ]]> + From e441b869ed10ed846b993059060d696096fad19f Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Fri, 1 May 2020 15:28:04 -0700 Subject: [PATCH 2/4] fix tolower/toupper signature --- xml/System/Char.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xml/System/Char.xml b/xml/System/Char.xml index 7ddde141264..51c9e25ec0f 100644 --- a/xml/System/Char.xml +++ b/xml/System/Char.xml @@ -4773,8 +4773,8 @@ This member is an explicit interface member implementation. It can be used only As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling character-casing and string-casing methods that substitute default values. Instead, you should call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. - - + + @@ -5173,8 +5173,8 @@ This member is an explicit interface member implementation. It can be used only As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling character-casing and string-casing methods that substitute default values. Instead, you should call methods that require parameters to be explicitly specified. To convert a character to uppercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. - - + + From 58fbfc0fbfcfc39f06a810254491de87eacdb055 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Fri, 1 May 2020 19:08:31 -0700 Subject: [PATCH 3/4] add rune links and text --- xml/System/Char.xml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/xml/System/Char.xml b/xml/System/Char.xml index 51c9e25ec0f..55d1a9a9a05 100644 --- a/xml/System/Char.xml +++ b/xml/System/Char.xml @@ -75,9 +75,11 @@ structure to represent a Unicode character. The Unicode Standard identifies each Unicode character with a unique 21-bit scalar number called a code point, and defines the UTF-16 encoding form that specifies how a code point is encoded into a sequence of one or more 16-bit values. Each 16-bit value ranges from hexadecimal 0x0000 through 0xFFFF and is stored in a structure. The value of a object is its 16-bit numeric (ordinal) value. +.NET uses the structure to represent Unicode code points by using UTF-16 encoding. The value of a object is its 16-bit numeric (ordinal) value. - The following sections examine the relationship between a object and a character and discuss some common tasks performed with instances. +If you aren't familiar with Unicode, scalar values, code points, surrogate pairs, UTF-16, and the type, see [Introduction to character encoding in .NET](/dotnet/standard/base-types/character-encoding-introduction). + +The following sections examine the relationship between a object and a character and discuss some common tasks performed with instances. We recommend that you consider the type, introduced in .NET Core 3.0, as an alternative to for performing some of these tasks. - [Char objects, Unicode characters, and strings](#Relationship) - [Characters and character categories](#Categories) @@ -140,14 +142,14 @@ |To do this|Use these `System.Char` methods| |----------------|-------------------------------------| |Compare objects| and | -|Convert a code point to a string|| -|Convert a object or a surrogate pair of objects to a code point|For a single character:

For a surrogate pair or a character in a string: | -|Get the Unicode category of a character|| -|Determine whether a character is in a particular Unicode category such as digit, letter, punctuation, control character, and so on|, , , , , , , , , , , , , , and | -|Convert a object that represents a number to a numeric value type|| +|Convert a code point to a string|

See also the type.| +|Convert a object or a surrogate pair of objects to a code point|For a single character:

For a surrogate pair or a character in a string:

See also the type.| +|Get the Unicode category of a character|

See also .| +|Determine whether a character is in a particular Unicode category such as digit, letter, punctuation, control character, and so on|, , , , , , , , , , , , , , and

See also corresponding methods on the type.| +|Convert a object that represents a number to a numeric value type|

See also .| |Convert a character in a string into a object| and | |Convert a object to a object|| -|Change the case of a object|, , , and | +|Change the case of a object|, , , and

See also corresponding methods on the type.| ## Char values and interop @@ -573,6 +575,7 @@ When a managed type, which is represented as a Unicode UTF-16 is not a position within . The specified index position contains a surrogate pair, and either the first character in the pair is not a valid high surrogate or the second character in the pair is not a valid low surrogate. + @@ -1118,6 +1121,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]>
+
@@ -2712,6 +2716,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -3547,6 +3552,7 @@ When a managed type, which is represented as a Unicode UTF-16 ]]> + @@ -4842,6 +4848,8 @@ This member is an explicit interface member implementation. It can be used only is . + + @@ -5241,6 +5249,8 @@ This member is an explicit interface member implementation. It can be used only is . + + From f4796f199ba86d31d51d0188530e84ac0aa0d076 Mon Sep 17 00:00:00 2001 From: Tom Dykstra Date: Mon, 4 May 2020 10:15:13 -0700 Subject: [PATCH 4/4] add rune example --- xml/System/Char.xml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xml/System/Char.xml b/xml/System/Char.xml index 55d1a9a9a05..2cd1431f142 100644 --- a/xml/System/Char.xml +++ b/xml/System/Char.xml @@ -105,9 +105,9 @@ The following sections examine the relationship between a obj ## Characters and character categories - Each Unicode character or valid surrogate pair belongs to a Unicode category. In the .NET Framework, Unicode categories are represented by members of the enumeration and include values such as , , and , for example. +Each Unicode character or valid surrogate pair belongs to a Unicode category. In the .NET Framework, Unicode categories are represented by members of the enumeration and include values such as , , and , for example. - To determine the Unicode category of a character, you call the method. For example, the following example calls the to display the Unicode category of each character in a string. +To determine the Unicode category of a character, call the method. For example, the following example calls the to display the Unicode category of each character in a string. The example works correctly only if there are no surrogate pairs in the instance. [!code-csharp[System.Char.Class#6](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.char.class/cs/GetUnicodeCategory3.cs#6)] [!code-vb[System.Char.Class#6](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.char.class/vb/GetUnicodeCategory3.vb#6)] @@ -125,6 +125,10 @@ The following sections examine the relationship between a obj - You can work with a object in its entirety instead of working with its individual characters to represent and analyze linguistic content. +- You can use as shown in the following example: + + :::code language="csharp" source="~/snippets/System.Text/Rune/csharp/CountLettersInString.cs" id="SnippetGoodExample"::: + - You can use the class to work with text elements instead of individual objects. The following example uses the object to count the number of text elements in a string that consists of the Aegean numbers zero through nine. Because it considers a surrogate pair a single character, it correctly reports that the string contains ten characters. [!code-csharp[System.Char.Class#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.char.class/cs/textelements2a.cs#4)] @@ -144,9 +148,9 @@ The following sections examine the relationship between a obj |Compare objects| and | |Convert a code point to a string|

See also the type.| |Convert a object or a surrogate pair of objects to a code point|For a single character:

For a surrogate pair or a character in a string:

See also the type.| -|Get the Unicode category of a character|

See also .| +|Get the Unicode category of a character|

See also .| |Determine whether a character is in a particular Unicode category such as digit, letter, punctuation, control character, and so on|, , , , , , , , , , , , , , and

See also corresponding methods on the type.| -|Convert a object that represents a number to a numeric value type|

See also .| +|Convert a object that represents a number to a numeric value type|

See also .| |Convert a character in a string into a object| and | |Convert a object to a object|| |Change the case of a object|, , , and

See also corresponding methods on the type.|