String

struct String
  • Parses a format string using a dictionary of arguments

    Replaces occurrences of "${key}" with their respective values.

    String(format: "Hello, ${user}", ["user": "Flavio"]) // Hello, Flavio
    

    Declaration

    Swift

    init(format: String, arguments: [String: CustomStringConvertible])

    Parameters

    format

    The string to be formatted.

    arguments

    A dictionary containing the which keys should be replaced by which values.

    Return Value

    A formatted string