mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 09:45:18 +00:00
String trimming in a centralized manner (#1079)
* String trimming in a centralized manner * Fix empty-nickname case
This commit is contained in:
@@ -28,7 +28,7 @@ extension Data {
|
||||
/// Whitespace is trimmed. Must have even length after prefix removal.
|
||||
/// - Returns: nil if the string has odd length or contains invalid hex characters.
|
||||
init?(hexString: String) {
|
||||
var hex = hexString.trimmingCharacters(in: .whitespaces)
|
||||
var hex = hexString.trimmed
|
||||
|
||||
// Remove optional 0x prefix
|
||||
if hex.hasPrefix("0x") || hex.hasPrefix("0X") {
|
||||
|
||||
Reference in New Issue
Block a user