Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 11bca94

Browse files
ufcpptarekgh
authored andcommitted
CharUnicodeInfo.GetUnicodeCategory(int codePoint) (#15911)
* CharUnicodeInfo.GetUnicodeCategory(int codePoint) https://github.com/dotnet/corefx/issues/26173 - renamed UnicodeCategory.InternalGetUnicodeCategory to GetUnicodeCategory - renamed its parameter ch to codePoint - made it public * fix build break
1 parent 7f8c67e commit 11bca94

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/mscorlib/shared/System/Char.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ public static UnicodeCategory GetUnicodeCategory(char c)
853853
{
854854
return (GetLatin1UnicodeCategory(c));
855855
}
856-
return CharUnicodeInfo.InternalGetUnicodeCategory(c);
856+
return CharUnicodeInfo.GetUnicodeCategory((int)c);
857857
}
858858

859859
public static UnicodeCategory GetUnicodeCategory(String s, int index)

src/mscorlib/shared/System/Globalization/CharUnicodeInfo.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public static int GetDigitValue(String s, int index)
276276

277277
public static UnicodeCategory GetUnicodeCategory(char ch)
278278
{
279-
return (InternalGetUnicodeCategory(ch));
279+
return (GetUnicodeCategory((int)ch));
280280
}
281281

282282
public static UnicodeCategory GetUnicodeCategory(String s, int index)
@@ -290,9 +290,9 @@ public static UnicodeCategory GetUnicodeCategory(String s, int index)
290290
return InternalGetUnicodeCategory(s, index);
291291
}
292292

293-
internal static unsafe UnicodeCategory InternalGetUnicodeCategory(int ch)
293+
public static UnicodeCategory GetUnicodeCategory(int codePoint)
294294
{
295-
return ((UnicodeCategory)InternalGetCategoryValue(ch, UNICODE_CATEGORY_OFFSET));
295+
return ((UnicodeCategory)InternalGetCategoryValue(codePoint, UNICODE_CATEGORY_OFFSET));
296296
}
297297

298298

@@ -352,7 +352,7 @@ internal static UnicodeCategory InternalGetUnicodeCategory(String value, int ind
352352
Debug.Assert(value != null, "value can not be null");
353353
Debug.Assert(index < value.Length, "index < value.Length");
354354

355-
return (InternalGetUnicodeCategory(InternalConvertToUtf32(value, index)));
355+
return (GetUnicodeCategory(InternalConvertToUtf32(value, index)));
356356
}
357357

358358
internal static BidiCategory GetBidiCategory(String s, int index)
@@ -381,7 +381,7 @@ internal static UnicodeCategory InternalGetUnicodeCategory(String str, int index
381381
Debug.Assert(str.Length > 0, "str.Length > 0"); ;
382382
Debug.Assert(index >= 0 && index < str.Length, "index >= 0 && index < str.Length");
383383

384-
return (InternalGetUnicodeCategory(InternalConvertToUtf32(str, index, out charLength)));
384+
return (GetUnicodeCategory(InternalConvertToUtf32(str, index, out charLength)));
385385
}
386386

387387
internal static bool IsCombiningCategory(UnicodeCategory uc)

src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ private unsafe static bool IsSortable(char *text, int length)
329329
if (index == length - 1 || !Char.IsLowSurrogate(text[index+1]))
330330
return false; // unpaired surrogate
331331

332-
uc = CharUnicodeInfo.InternalGetUnicodeCategory(Char.ConvertToUtf32(text[index], text[index+1]));
332+
uc = CharUnicodeInfo.GetUnicodeCategory(Char.ConvertToUtf32(text[index], text[index+1]));
333333
if (uc == UnicodeCategory.PrivateUse || uc == UnicodeCategory.OtherNotAssigned)
334334
return false;
335335

0 commit comments

Comments
 (0)