diff --git a/bitchat/Views/GeohashPeopleList.swift b/bitchat/Views/GeohashPeopleList.swift index db7c3aa8..098bc99e 100644 --- a/bitchat/Views/GeohashPeopleList.swift +++ b/bitchat/Views/GeohashPeopleList.swift @@ -64,7 +64,7 @@ struct GeohashPeopleList: View { let rowColor: Color = isMe ? .orange : assignedColor Image(systemName: icon).font(.bitchatSystem(size: 12)).foregroundColor(rowColor) - let (base, suffix) = splitSuffix(from: person.displayName) + let (base, suffix) = person.displayName.splitSuffix() HStack(spacing: 0) { Text(base) .font(.bitchatSystem(size: 14, design: .monospaced)) @@ -129,16 +129,3 @@ struct GeohashPeopleList: View { } } } - -// Helper to split a trailing #abcd suffix -private func splitSuffix(from name: String) -> (String, String) { - guard name.count >= 5 else { return (name, "") } - let suffix = String(name.suffix(5)) - if suffix.first == "#", suffix.dropFirst().allSatisfy({ c in - ("0"..."9").contains(String(c)) || ("a"..."f").contains(String(c)) || ("A"..."F").contains(String(c)) - }) { - let base = String(name.dropLast(5)) - return (base, suffix) - } - return (name, "") -} diff --git a/bitchat/Views/MeshPeerList.swift b/bitchat/Views/MeshPeerList.swift index 94390c7f..0dbd4089 100644 --- a/bitchat/Views/MeshPeerList.swift +++ b/bitchat/Views/MeshPeerList.swift @@ -82,7 +82,7 @@ struct MeshPeerList: View { } let displayName = isMe ? viewModel.nickname : peer.nickname - let (base, suffix) = splitSuffix(from: displayName) + let (base, suffix) = displayName.splitSuffix() HStack(spacing: 0) { Text(base) .font(.bitchatSystem(size: 14, design: .monospaced)) @@ -166,16 +166,3 @@ struct MeshPeerList: View { } } } - -// Helper to split a trailing #abcd suffix -private func splitSuffix(from name: String) -> (String, String) { - guard name.count >= 5 else { return (name, "") } - let suffix = String(name.suffix(5)) - if suffix.first == "#", suffix.dropFirst().allSatisfy({ c in - ("0"..."9").contains(String(c)) || ("a"..."f").contains(String(c)) || ("A"..."F").contains(String(c)) - }) { - let base = String(name.dropLast(5)) - return (base, suffix) - } - return (name, "") -}