Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Eduardo Florence
2021-01-04 19:58:18 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5e746d388664885a9576636ea78054f724ad6903
5e746d38
1 parent
3444754f
Utils: capitalize cannot convert space to null
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
lib/get_utils/src/get_utils/get_utils.dart
lib/get_utils/src/get_utils/get_utils.dart
View file @
5e746d3
...
...
@@ -518,17 +518,16 @@ class GetUtils {
/// Capitalize each word inside string
/// Example: your name => Your Name, your name => Your name
static
String
capitalize
(
String
value
)
{
if
(
isNullOrBlank
(
value
))
return
null
;
if
(
isNull
(
value
))
return
null
;
if
(
isBlank
(
value
))
return
value
;
return
value
.
split
(
' '
).
map
(
capitalizeFirst
).
join
(
' '
);
}
/// Uppercase first letter inside string and let the others lowercase
/// Example: your name => Your name
static
String
capitalizeFirst
(
String
s
)
{
if
(
isNullOrBlank
(
s
))
{
return
null
;
}
if
(
isNull
(
s
))
return
null
;
if
(
isBlank
(
s
))
return
s
;
return
s
[
0
].
toUpperCase
()
+
s
.
substring
(
1
).
toLowerCase
();
}
...
...
Please
register
or
login
to post a comment