Showing
1 changed file
with
4 additions
and
5 deletions
@@ -518,17 +518,16 @@ class GetUtils { | @@ -518,17 +518,16 @@ class GetUtils { | ||
518 | /// Capitalize each word inside string | 518 | /// Capitalize each word inside string |
519 | /// Example: your name => Your Name, your name => Your name | 519 | /// Example: your name => Your Name, your name => Your name |
520 | static String capitalize(String value) { | 520 | static String capitalize(String value) { |
521 | - if (isNullOrBlank(value)) return null; | 521 | + if (isNull(value)) return null; |
522 | + if (isBlank(value)) return value; | ||
522 | return value.split(' ').map(capitalizeFirst).join(' '); | 523 | return value.split(' ').map(capitalizeFirst).join(' '); |
523 | } | 524 | } |
524 | 525 | ||
525 | /// Uppercase first letter inside string and let the others lowercase | 526 | /// Uppercase first letter inside string and let the others lowercase |
526 | /// Example: your name => Your name | 527 | /// Example: your name => Your name |
527 | static String capitalizeFirst(String s) { | 528 | static String capitalizeFirst(String s) { |
528 | - if (isNullOrBlank(s)) { | ||
529 | - return null; | ||
530 | - } | ||
531 | - | 529 | + if (isNull(s)) return null; |
530 | + if (isBlank(s)) return s; | ||
532 | return s[0].toUpperCase() + s.substring(1).toLowerCase(); | 531 | return s[0].toUpperCase() + s.substring(1).toLowerCase(); |
533 | } | 532 | } |
534 | 533 |
-
Please register or login to post a comment