EXTENSION
public extension String
var removeHTML: String
Remove HTML tags from String
var isEmail: Bool
Is valid email
var areNumbers: Bool
Are numbers 0-9
var toInt: Int?
Cast to Int
var toDouble: Double?
Cast to Double
var trimmingZeroDecimal: String
Trimming ".0"
var addingPlusSymbol: String
Adding "+" at the very beginning.
var addingMinusSymbol: String
Adding "-" at the very beginning.
var uppercasingFirstLetter: String
var lowercasingFirstLetter: String
var isBlank: Bool
Return true
if self is empty or only contains white spaces and/or new lines.
var isVisible: Bool
Return false
if self is empty or only contains white spaces and/or new lines.
var nilIfBlank: String?
Return nil
if self.isBlank
is true
.
func trim() -> String
Trim white space and new lines
func layoutSize(with font: UIFont) -> CGSize
Returns the CGSize that the string being layout on screen.
- Parameter font: The given font.
- Returns: The result CGSize.
Name | Description |
---|---|
font | The given font. |
mutating func advanceNumberValue(step: Int = 1)
Cast as Int and add the given value. No changes if casting fails.
func isOldAppVersion(comparedWith aVersion: String) -> Bool
Comparing app versions. Returns true
if self is 1.1.0
and the given value is 1.2.0
.
- Parameter aVersion: Another version.
- Returns:
true
if the give version is newer than self.
Name | Description |
---|---|
aVersion | Another version. |
func treatsVisuallyEmptyAsNil() -> String?
func slice(from: String, to: String) -> String?
Get subscring from created range
- Parameters:
- from: from String
- to: to String
- Returns: String
Name | Description |
---|---|
from | from String |
to | to String |
func copyToPasteboard()
Copy self to UIPasteboard