ScriptClassifier

public class ScriptClassifier

This class implements UAX #24 available at http://www.unicode.org/reports/tr24.

  • Creates a script classifier for the specified string.

    Declaration

    Swift

    public init(string: String)

    Parameters

    string

    The string whose script classification is desired.

  • The string that the script classifier was created for.

    Declaration

    Swift

    public let string: String
  • The resolved scripts of all characters in source string.

    Declaration

    Swift

    public var characterScripts: CharacterScripts { get }
  • Returns a sequence of resolved script runs within the specified UTF-16 range of source string.

    Declaration

    Swift

    public func scriptRuns(forCodeUnitRange codeUnitRange: Range<Int>) -> RunSequence

    Parameters

    codeUnitRange

    The UTF-16 range in source string.

    Return Value

    A sequence of script runs within the specified UTF-16 range of source string.

  • Returns a sequence of resolved script runs within the specified character range of source string.

    Declaration

    Swift

    public func scriptRuns(forCharacterRange characterRange: Range<String.Index>) -> RunSequence

    Parameters

    characterRange

    The character range in source string.

    Return Value

    A sequence of script runs within the specified character range of source string.

CharacterScripts

  • A collection of the scripts of a string, represented by UTF-16 code unit indices.

    See more

    Declaration

    Swift

    public struct CharacterScripts : RandomAccessCollection

RunSequence