| Index: pkg/analysis_server/lib/src/services/correction/strings.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/correction/strings.dart b/pkg/analysis_server/lib/src/services/correction/strings.dart
|
| index 3c44fb626d5875c576330e55f5a55d44537e355f..c2ea6cbcb49b5395005f10e9132241192df26b74 100644
|
| --- a/pkg/analysis_server/lib/src/services/correction/strings.dart
|
| +++ b/pkg/analysis_server/lib/src/services/correction/strings.dart
|
| @@ -119,6 +119,46 @@ int findCommonSuffix(String a, String b) {
|
| }
|
|
|
| /**
|
| + * Returns a list of words for the given camel case string.
|
| + *
|
| + * 'getCamelWords' => ['get', 'Camel', 'Words']
|
| + * 'getHTMLText' => ['get', 'HTML', 'Text']
|
| + */
|
| +List<String> getCamelWords(String str) {
|
| + if (str == null || str.isEmpty) {
|
| + return <String>[];
|
| + }
|
| + List<String> parts = <String>[];
|
| + bool wasLowerCase = false;
|
| + bool wasUpperCase = false;
|
| + int wordStart = 0;
|
| + for (int i = 0; i < str.length; i++) {
|
| + int c = str.codeUnitAt(i);
|
| + var newLowerCase = isLowerCase(c);
|
| + var newUpperCase = isUpperCase(c);
|
| + // myWord
|
| + // | ^
|
| + if (wasLowerCase && newUpperCase) {
|
| + parts.add(str.substring(wordStart, i));
|
| + wordStart = i;
|
| + }
|
| + // myHTMLText
|
| + // | ^
|
| + if (wasUpperCase &&
|
| + newUpperCase &&
|
| + i + 1 < str.length &&
|
| + isLowerCase(str.codeUnitAt(i + 1))) {
|
| + parts.add(str.substring(wordStart, i));
|
| + wordStart = i;
|
| + }
|
| + wasLowerCase = newLowerCase;
|
| + wasUpperCase = newUpperCase;
|
| + }
|
| + parts.add(str.substring(wordStart));
|
| + return parts;
|
| +}
|
| +
|
| +/**
|
| * Checks if [str] is `null`, empty or is whitespace.
|
| */
|
| bool isBlank(String str) {
|
|
|