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
zhenglu
2020-09-22 23:47:16 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
717709c0e2689585df00ba40ff9be2d3fcaf1b6b
717709c0
1 parent
879086fd
Optimize capitalize method
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
13 deletions
packages/get_utils/lib/src/get_utils/get_utils.dart
packages/get_utils/lib/src/get_utils/get_utils.dart
View file @
717709c
...
...
@@ -506,19 +506,8 @@ 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
;
}
final
separatedWords
=
value
.
split
(
' '
);
var
result
=
''
;
for
(
var
word
in
separatedWords
)
{
result
+=
capitalizeFirst
(
word
);
result
+=
' '
;
}
return
result
.
trim
();
if
(
isNullOrBlank
(
value
))
return
null
;
return
value
.
split
(
' '
).
map
(
capitalizeFirst
).
join
(
' '
);
}
/// Uppercase first letter inside string and let the others lowercase
...
...
Please
register
or
login
to post a comment