mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 14:25:20 +00:00
* Run local packages’ tests as well on CI * BitFoundation module to centralize shared components
23 lines
491 B
Swift
23 lines
491 B
Swift
//
|
|
// String+Ext.swift
|
|
// BitFoundation
|
|
//
|
|
// This is free and unencumbered software released into the public domain.
|
|
// For more information, see <https://unlicense.org>
|
|
//
|
|
|
|
public extension StringProtocol {
|
|
var trimmed: String {
|
|
trimmingCharacters(in: .whitespacesAndNewlines)
|
|
}
|
|
|
|
var trimmedOrNilIfEmpty: String? {
|
|
let trimmed = self.trimmed
|
|
return trimmed.isEmpty ? nil : trimmed
|
|
}
|
|
|
|
var nilIfEmpty: Self? {
|
|
isEmpty ? nil : self
|
|
}
|
|
}
|