forked from Nexus/nexus
treewide: small refactors
This commit is contained in:
parent
9117663c48
commit
8d944831f5
10 changed files with 63 additions and 63 deletions
|
|
@ -1,6 +1,9 @@
|
|||
extension GetLocalpart on String {
|
||||
String get localpart => length > 1 ? substring(1).split(":").first : "?";
|
||||
|
||||
/// Whether this looks like a valid Matrix user ID, e.g. `@user:example.com`.
|
||||
bool get isValidUserId => RegExp(r"^@[^:\s]+:[^\s]+$").hasMatch(this);
|
||||
|
||||
String? get serverName {
|
||||
final index = indexOf(":");
|
||||
return index == -1 ? null : substring(index + 1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue