String
> Create a new random string of given length:
```swift
String(random: 10) // "zXWG4hSgL9"
String(random: 4, prefix: "PIN-") // "PIN-uSjm"
```
> Safely use subscript indexes and ranges on strings:
```swift
let value = "Abcdef123456"
value[3] // "d"
value[3..<6] // "def"
value[3...6] // "def1"
value[3...] // "def123456"
value[3...99] // nil
value[99] // nil
```
> Validate string against common formats:
```swift
"test@example.com".isEmail // true
"123456789".isNumber // true
"zamzam".isAlpha // true
"zamzam123".isAlphaNumeric // true
```
> Remove spaces or new lines from both ends:
```swift
" Abcdef123456 \n\r ".trimmed // "Abcdef123456"
```
> Truncate to a given number of characters:
```swift
"Abcdef123456".truncated(3) // "Abc..."
"Abcdef123456".truncated(6, trailing: "***") // "Abcdef***"
```
> Determine if a given value is contained:
```swift
"1234567890".contains("567") // true
"abc123xyz".contains("ghi") // false
```
> Injects a separator every nth characters:
```swift
"1234567890".separated(every: 2, with: "-") // "12-34-56-78-90"
```
> Remove the characters contained in a given set:
```swift
let string = """
{ 0 1
2 34
56 7 8
9
}
"""
string.strippingCharacters(in: .whitespacesAndNewlines) // {0123456789}
```
> Replace the characters contained in a given character set with another string:
```swift
let set = CharacterSet.alphanumerics
.insert(charactersIn: "_")
.inverted
let string = """
_abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ
0{1 2<3>4@5#6`7~8?9,0
1
"""
string.replacingCharacters(in: set, with: "_") //_abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ_0_1_2_3_4_5_6_7_8_9_0__1
```
> Match using a regular expression pattern:
```swift
"1234567890".match(regex: "^[0-9]+?$") // true
"abc123xyz".match(regex: "^[A-Za-z]+$") // false
```
> Replace occurrences of a regular expression pattern:
```swift
"aa1bb22cc3d888d4ee5".replacing(regex: "\\d", with: "*") // "aa*bb**cc*d***d*ee*"
```
> Remove HTML for plain text:
```swift
"This is web content with a link.
".htmlStripped // "This is web content with a link."
```
> Encoders and decoders:
```swift
value.urlEncoded()
value.urlDecoded()
value.htmlDecoded()
value.base64Encoded()
value.base64Decoded()
value.base64URLEncoded()
```
> Get an encrypted version of the string in hex format:
```swift
"test@example.com".sha256() // 973dfe463ec85785f5f95af5ba3906eedb2d931c24e69824a89ea65dba4e813b
```
> Easily get the string version of substring:
```swift
"hello world".prefix(5).string
```
> Determine if an optional string is `nil` or has no characters
```swift
var value: String? = "test 123"
value.isNilOrEmpty
```
### Foundation+