String Extension - Kelmatou/iOSTools GitHub Wiki

Properties

  • var length: Int

Methods

  • func substring(startIndex: Int) -> String?
  • func substring(startIndex: Int, length: Int) -> String?
  • func numberOccurence(of pattern: String) -> Int
  • func firstOccurencePosition(of pattern: String) -> Int?
  • func capitalizeFirstLetter() -> String

Operators

  • String * Int

Definitions

  • var length: Int: Get the length of the String encoded in UTF8.

  • func substring(startIndex: Int) -> String?: Get a new String from startIndex to the end. startIndex must be contained in [0;length] or it will result in a nil String.

  • func substring(startIndex: Int, length: Int) -> String?: Get a new String of size Length from startIndex. startIndex must be contained in [0;length] and Length must be more than 0 or it will result in a nil String.

  • func numberOccurence(of pattern: String) -> Int: Get the number of occurence of pattern in current String.

  • func firstOccurencePosition(of pattern: String) -> Int?: Get the index of first occurence of pattern in current String. Index starts at 0.

  • func capitalizeFirstLetter() -> String: Get current String with first letter capitalized.

  • String * Int: This operator will create a new String which is the result of 'Int' concatenations of 'String'.