| 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 c2ea6cbcb49b5395005f10e9132241192df26b74..1689c7c5727e95c537ada39923431340529f342e 100644
|
| --- a/pkg/analysis_server/lib/src/services/correction/strings.dart
|
| +++ b/pkg/analysis_server/lib/src/services/correction/strings.dart
|
| @@ -41,6 +41,17 @@ int compareStrings(String a, String b) {
|
| return a.compareTo(b);
|
| }
|
|
|
| +int countLeadingWhitespaces(String str) {
|
| + int i = 0;
|
| + for (; i < str.length; i++) {
|
| + int c = str.codeUnitAt(i);
|
| + if (!isWhitespace(c)) {
|
| + break;
|
| + }
|
| + }
|
| + return i;
|
| +}
|
| +
|
| /**
|
| * Counts how many times [sub] appears in [str].
|
| */
|
| @@ -57,6 +68,17 @@ int countMatches(String str, String sub) {
|
| return count;
|
| }
|
|
|
| +int countTrailingWhitespaces(String str) {
|
| + int i = 0;
|
| + for (; i < str.length; i++) {
|
| + int c = str.codeUnitAt(str.length - 1 - i);
|
| + if (!isWhitespace(c)) {
|
| + break;
|
| + }
|
| + }
|
| + return i;
|
| +}
|
| +
|
| /**
|
| * Returns the number of characters common to the end of [a] and the start
|
| * of [b].
|
|
|