String

extension String
  • A static extension method that returns a timestamp formatted as an non-breaking string.

    The non-breaking format is intended as a convenience for adding a timestamp to a file name.

    Declaration

    Swift

    static func makeSimpleTimeStamp() -> String

    Return Value

    A timestamp formatted as a non-breaking string.

  • An extension method that returns an Int representing the count value of the String that includes Apple symbols, letters, numbers and whitespace. Apple symbols have their count multiplied by 2.

    Important

    Apple symbols return a character count value of 1 but use the space of two characters in the console.

    The method count calculation is predicated on the fact that a string assigned for a user symbol could include any combination of character types.

    There are three main task phases to the method:

    1. Use map and filter to return a count of Apple symbols in the string.
    2. Use map and filter to return a count of the other character types in the string.
    3. Return the value of the combined count after multiplying the Apple symbol count by 2 .

    Declaration

    Swift

    func symbolSpaceCount() -> Int