UnicodeScripts Class
Provides access to the Unicode Script and Script_Extensions character properties.
public static class UnicodeScriptsProperties
| Name | Description |
|---|---|
| MaxScriptExtensionCount | Gets the greatest number of scripts UnicodeScripts.GetScriptExtensions writes for a code point. |
MaxScriptExtensionCount
UnicodeScripts.csGets the greatest number of scripts UnicodeScripts.GetScriptExtensions writes for a code point.
public static int MaxScriptExtensionCount { get; }Property value
Methods
| Name | Description |
|---|---|
| GetIso15924Code(UnicodeScript) | Gets the four-letter ISO 15924 code of a script, such as Latn. |
| GetScript(int) | Gets the script of a code point. |
| GetScript(Rune) | Gets the script of a rune. |
| GetScriptExtensions(int, Span<UnicodeScript>) | Gets the Script_Extensions of a code point: the scripts it is used with. |
| HasScriptExtension(int, UnicodeScript) | Determines whether a script is one of the Script_Extensions of a code point. |
| TryParseScript(ReadOnlySpan<char>, UnicodeScript) | Gets the script that a name of the Script property designates, such as Latin or Latn. |
GetIso15924Code(UnicodeScript)
UnicodeScripts.csGets the four-letter ISO 15924 code of a script, such as Latn.
public static string GetIso15924Code(UnicodeScript script)Parameters
scriptUnicodeScript- The script.
Returns
string The code; Zzzz for UnicodeScript.Unknown and for a value that is not defined.
GetScript overloads
GetScript(int)
UnicodeScripts.csGets the script of a code point.
public static UnicodeScript GetScript(int codePoint)Parameters
codePointint- The code point.
Returns
UnicodeScript The script, or UnicodeScript.Unknown when the code point has no assigned script.
GetScript(Rune)
UnicodeScripts.csGets the script of a rune.
public static UnicodeScript GetScript(Rune rune)Parameters
runeRune- The rune.
Returns
UnicodeScript The script, or UnicodeScript.Unknown when the rune has no assigned script.
GetScriptExtensions(int, Span<UnicodeScript>)
UnicodeScripts.csGets the Script_Extensions of a code point: the scripts it is used with.
public static int GetScriptExtensions(int codePoint, Span<UnicodeScript> destination)Parameters
codePointint- The code point.
destinationSpan<UnicodeScript>- The buffer that receives the scripts, in increasing numeric value.
Returns
int The number of scripts written. It is 1, the script of UnicodeScripts.GetScript, for a code point that has no explicit Script_Extensions value.
Exceptions
ArgumentExceptiondestinationis too small.UnicodeScripts.MaxScriptExtensionCountelements are always enough.
See also
HasScriptExtension(int, UnicodeScript)
UnicodeScripts.csDetermines whether a script is one of the Script_Extensions of a code point.
public static bool HasScriptExtension(int codePoint, UnicodeScript script)Parameters
codePointint- The code point.
scriptUnicodeScript- The script.
Returns
bool true when the code point is used with the script.
TryParseScript(ReadOnlySpan<char>, UnicodeScript)
UnicodeScripts.csGets the script that a name of the Script property designates, such as Latin or Latn.
public static bool TryParseScript(ReadOnlySpan<char> name, out UnicodeScript script)Parameters
nameReadOnlySpan<char>- The long name, the short name (the ISO 15924 code) or another alias of the script, as listed in
PropertyValueAliases.txt. scriptUnicodeScript- The script, when the method returns
true.
Returns
bool true when the name is a name of a script.
Remarks
The comparison is ordinal: the loose matching of UAX #44 (ignoring case, spaces, hyphens and underscores) is not applied. Unknown and Zzzz designate UnicodeScript.Unknown.