Subscripts

The following subscripts are available globally.

  • Mechanica*

    Gets the character at the specified index as String.

    Declaration

    Swift

    public subscript (index: Int) -> String?

    Parameters

    index

    index Position of the character to get

    Return Value

    Character as String or nil if the index is out of bounds

  • Mechanica*

    Returns the range of the first occurrence of a given string in the String.

    Declaration

    Swift

    public subscript (substring: String) -> Range<String.Index>?

    Parameters

    substring

    substring

    Return Value

    range of the first occurrence or nil.

  • Mechanica*

    Returns the substring in the given NSRange

    Declaration

    Swift

    public subscript (range: NSRange) -> String?

    Parameters

    range

    NSRange

    Return Value

    Substring in range or nil.

  • Mechanica*

    Returns the substring in the given range.

    Declaration

    Swift

    public subscript (range: Range<Int>) -> String?

    Parameters

    range

    range

    Return Value

    Substring in range or nil.