Array

extension Array where Element == String
extension Array where Element: Comparable

Available where Element == String

  • Join this array of strings with new line separator.

    Declaration

    Swift

    public func joinedWithNewLine() -> String
  • Join this array of strings with space separator.

    Declaration

    Swift

    public func joinedWithSpace() -> String

Available where Element: Comparable

  • Perform a binary search to find the index of the element. Binary search is useful to find an element in a sorted array. Complexity: O(log n)

    Declaration

    Swift

    public func binarySearch(for element: Element) -> Index?

    Parameters

    element

    the element to find.

    Return Value

    the index of the found element.