String

  • Add support for strings style with StringStyle constants.

    See more

    Declaration

    Swift

    public extension String.StringInterpolation
  • Creates a string with the content of the file at the given path.

    Declaration

    Swift

    @inlinable
    init(contentsOf path: Path) throws

    Parameters

    path

    The location of file.

  • Writes this string to file on path.

    Declaration

    Swift

    @discardableResult
    func write(to path: Path,
               append: Bool = false,
               atomically useAuxiliaryFile: Bool = false,
               encoding targetEncoding: String.Encoding = .utf8) throws -> Path

    Parameters

    path

    The location to which to write this string.

    append

    Appends the string to the end of file.

    useAuxiliaryFile

    If true, the string is written to a backup location, and then the backup location is renamed to the name specified by path; otherwise, the data is written directly to path.

    targetEncoding

    The encoding in which the string should be interpreted.

    Return Value

    The path to allow chaining.