StringProtocol

extension StringProtocol
  • Removes trailing newlines from the given string subsequence.

    Declaration

    Swift

    public func removingTrailingNewlines() -> Self.SubSequence
  • If self ends with suffix, self sans that suffix, or self otherwise.

    Declaration

    Swift

    public func removingSuffix<S>(_ suffix: S) -> Self.SubSequence where S : Collection, S.Element == Character
  • Returns the indices of the start of each line, in order.

    Declaration

    Swift

    public func lineBoundaries() -> [Index]
  • Returns each line of text in order, sans terminating newline.

    Declaration

    Swift

    public func lineContents() -> [SubSequence]
  • Replace any succession of whitespace characters (including newlines and tabs) with a single white space character.

    Declaration

    Swift

    public func canonicalize() -> String
  • Returns self in snake_case, given it is in PascalCase or camelCase.

    Declaration

    Swift

    public func snakeCased() -> String