StringProtocol
public extension StringProtocol
-
Returns string as URL. Properly escapes URL components if needed.
Declaration
Swift
var asURL: URL? { get }
-
Returns
self
as file URLDeclaration
Swift
var asFileURL: URL { get }
-
Returns
self
asInt
Declaration
Swift
var asInt: Int? { get }
-
Returns
self
asDouble
Declaration
Swift
var asDouble: Double? { get }
-
Returns
self
asString
Declaration
Swift
var asString: String { get }
-
Returns string as NSAttributedString
Declaration
Swift
var asAttributedString: NSAttributedString { get }
-
Returns string as NSMutableAttributedString
Declaration
Swift
var asMutableAttributedString: NSMutableAttributedString { get }
-
Returns base64 encoded string
Declaration
Swift
var encodedBase64: String? { get }
-
Returns string decoded from base64 string
Declaration
Swift
var decodedBase64: String? { get }
-
Strips whitespace and new line characters
Declaration
Swift
var trimmed: String { get }
-
Splits string by capital letters without stripping them
Declaration
Swift
var splittedByCapitals: [String] { get }
-
Split string into slices of specified length
Declaration
Swift
func splitByLength(_ length: Int) -> [String]
-
Width of a string written in one line.
Declaration
Swift
func oneLineWidth(font: UIFont) -> CGFloat
-
Height of a string for specified font and width.
Declaration
Swift
func height(font: UIFont, width: CGFloat) -> CGFloat
-
Height of a string for specified attributes and width.
Declaration
Swift
func height(attributes: [NSAttributedString.Key : Any], width: CGFloat) -> CGFloat
-
Undocumented
Declaration
Swift
func capitalizingFirstLetter() -> String
-
Undocumented
Declaration
Swift
subscript(value: Int) -> Character { get }
-
Undocumented
Declaration
Swift
subscript(value: NSRange) -> SubSequence { get }
-
Undocumented
Declaration
Swift
subscript(value: CountableClosedRange<Int>) -> SubSequence { get }
-
Undocumented
Declaration
Swift
subscript(value: CountableRange<Int>) -> SubSequence { get }
-
Undocumented
Declaration
Swift
subscript(value: PartialRangeUpTo<Int>) -> SubSequence { get }
-
Undocumented
Declaration
Swift
subscript(value: PartialRangeThrough<Int>) -> SubSequence { get }
-
Undocumented
Declaration
Swift
subscript(value: PartialRangeFrom<Int>) -> SubSequence { get }