String

extension String
  • Returns a new string, converting the path to a canonical absolute path.

    Declaration

    Swift

    public func absolutePathStandardized() -> String

    Return Value

    A new String.

  • Count the number of occurrences of the given character in self

    Declaration

    Swift

    public func countOccurrences(of character: Character) -> Int

    Parameters

    character

    Character to count

    Return Value

    Number of times character occurs in self

  • If self is a path, this method can be used to get a path expression relative to a root directory

    Declaration

    Swift

    public func path(relativeTo rootDirectory: String) -> String