mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-06 19:40:08 +02:00
🐛 Empty byte count now returns a warning symbol
This commit is contained in:
@ -129,9 +129,18 @@ class ActivePhpInstallation {
|
||||
return "∞"
|
||||
}
|
||||
|
||||
if value.isEmpty {
|
||||
return "⚠️"
|
||||
}
|
||||
|
||||
// Check if the syntax is valid otherwise
|
||||
let regex = try! NSRegularExpression(pattern: #"^([0-9]*)(K|M|G|)$"#, options: [])
|
||||
let match = regex.matches(in: value, options: [], range: NSRange(location: 0, length: value.count)).first
|
||||
|
||||
let match = regex.matches(
|
||||
in: value, options: [],
|
||||
range: NSRange(location: 0, length: value.count)
|
||||
).first
|
||||
|
||||
return (match == nil) ? "⚠️" : "\(value)B"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user