String

struct String
  • Changes underscores to camelCase

    Returns

    String with all instances of _char replaced with Char

    Declaration

    Swift

    public var underscoreToCamelCase: String

    Return Value

    String with all instances of _char replaced with Char

  • Sets the first character in a string to uppercase.

    Returns

    String

    Declaration

    Swift

    public var uppercaseFirst: String

    Return Value

    String

  • Removes white spaces from a string.

    Returns

    String

    Declaration

    Swift

    public var trim: String

    Return Value

    String

  • Truncates a string and appends trailing characters if the number of characters in the string exceeds truncated length

    Parameter

    Parameter length: int the number of characters from the start where the trucation occurs

    Parameter

    Parameter trailing: string to append to the end of the turncation (if required). Defaults to ...

    Returns

    String

    Declaration

    Swift

    public func truncate(length: Int, trailing: String? = "...") -> String

    Parameters

    length

    int the number of characters from the start where the trucation occurs

    trailing

    string to append to the end of the turncation (if required). Defaults to ...

    Return Value

    String

  • Url encodes a string

    Declaration

    Swift

    public var urlEncode: String
  • Splits a string into an array by the given delimiter

    Parameter

    Parameter delimiter: string to use as the splitter

    Returns

    [String]

    Declaration

    Swift

    public func split(delimiter: String) -> [String]

    Parameters

    delimiter

    string to use as the splitter

    Return Value

    [String]

  • Determines if a string is a valid email address

    Returns

    Bool

    Declaration

    Swift

    public var isValidEmail:Bool

    Return Value

    Bool

  • Counts the number of charaters in a string

    Returns

    Int - the number of characters

    Declaration

    Swift

    public var count:Int { return self.characters.count }

    Return Value

    Int - the number of characters

  • Converts a string to NSDate if possible

    Parameter

    Parameter format: the date format. The default is ISO yyyy-MM-dd'T'HH:mm:ssZZZZ

    Returns

    NSDate?

    Declaration

    Swift

    public func toDate(format:String = "yyyy-MM-dd'T'HH:mm:ssZZZZ") -> NSDate?

    Parameters

    format

    the date format. The default is ISO yyyy-MM-dd'T'HH:mm:ssZZZZ

    Return Value

    NSDate?

  • Undocumented

    Declaration

    Swift

    struct String
  • Removes all html from a string

    Returns

    String?

    Declaration

    Swift

    public var stripHTML: String?

    Return Value

    String?