31 lines
586 B
Dart
31 lines
586 B
Dart
extension PassphaseURL on String {
|
|
String capitalize() {
|
|
return "${this[0].toUpperCase()}${substring(1).toLowerCase()}";
|
|
}
|
|
|
|
String toURL() {
|
|
var words = split(' ');
|
|
|
|
for (var i = 0; i < words.length; i++) {
|
|
words[i] = words[i].capitalize();
|
|
}
|
|
|
|
return words.join();
|
|
}
|
|
|
|
String toPhraseWithSpaces() {
|
|
var phrase = '';
|
|
|
|
for (var i = 0; i < length; i++) {
|
|
if (this[i] == this[i].toUpperCase()) {
|
|
phrase += ' ';
|
|
}
|
|
phrase += this[i].toLowerCase();
|
|
}
|
|
|
|
phrase = phrase.trim();
|
|
|
|
return phrase.toLowerCase();
|
|
}
|
|
}
|