Index: tools/gardening/lib/src/util.dart |
diff --git a/tools/gardening/lib/src/util.dart b/tools/gardening/lib/src/util.dart |
index 2e48792829e170eda60e0be46ad68182c7c6362a..22161bc1cc31035ff0b6ce41972c9b7e7d020130 100644 |
--- a/tools/gardening/lib/src/util.dart |
+++ b/tools/gardening/lib/src/util.dart |
@@ -108,9 +108,13 @@ void processArgResults(ArgResults argResults) { |
/// Strips un-wanted characters from string [category] from CBE json. |
String sanitizeCategory(String category) { |
- // Category name starts with either two or three numbers and |
- // end with |all. Instead of doing any fancy regular-expr, |
- // we just test if third char is a number. |
- return category.substring( |
- category.codeUnitAt(2) <= 64 ? 3 : 2, category.length - 4); |
+ // Category name starts with a channel number (normally consisting of 1-3 |
Bill Hesse
2017/09/01 11:10:57
LGTM, but could you just regexp match $[0-9]+(.*)\
mkroghj
2017/09/01 11:37:34
swapped $ and ^.
Done
|
+ // digits) and ends with |all. Instead of doing any fancy regular-expr, |
+ // we just test if the char is not an alpha-char. |
+ int firstIndex = 0; |
+ while ( |
+ category.codeUnitAt(firstIndex) <= 64 && firstIndex < category.length) { |
+ firstIndex++; |
+ } |
+ return category.substring(firstIndex, category.length - 4); |
} |