diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-06-15 10:35:47 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-15 10:35:47 +1000 |
| commit | e556de927015acd8d9934e68707a95901acfad8e (patch) | |
| tree | c04e9601a15cff5f1fe9980e8f2ff41bae351635 /Util.cs | |
| parent | df4bfad33e1b3fc2ce35af8000380029ecb444cf (diff) | |
Diffstat (limited to 'Util.cs')
| -rw-r--r-- | Util.cs | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -5,6 +5,11 @@ public static class Extensions { "K", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q" }; + public static string? NullIfEmpty(this string s) { + s = s.Trim(); + return string.IsNullOrEmpty(s) ? null : s; + } + public static DateTime? TryParseDateTimeUtc(this string s) { bool success = DateTime.TryParse(s, out var dateTime); return success ? DateTime.SpecifyKind(dateTime, DateTimeKind.Utc) : null; |
