Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Side by Side Diff: tools/gardening/lib/src/util.dart

Issue 2993913002: Add filtering to 'summary' (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gardening/bin/summary.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:args/args.dart'; 9 import 'package:args/args.dart';
10 10
11 import 'cache.dart'; 11 import 'cache.dart';
12 12
13 /// Checks that [haystack] contains substring [needle], case insensitive.
14 /// Throws an exception if either parameter is `null`.
15 bool containsIgnoreCase(String haystack, String needle) {
16 if (haystack == null) {
17 throw "Unexpected null as the first paramter value of containsIgnoreCase";
18 }
19 if (needle == null) {
20 throw "Unexpected null as the second parameter value of containsIgnoreCase";
21 }
22 return haystack.toLowerCase().contains(needle.toLowerCase());
23 }
24
13 /// Split [text] using [infixes] as infix markers. 25 /// Split [text] using [infixes] as infix markers.
14 List<String> split(String text, List<String> infixes) { 26 List<String> split(String text, List<String> infixes) {
15 List<String> result = <String>[]; 27 List<String> result = <String>[];
16 int start = 0; 28 int start = 0;
17 for (String infix in infixes) { 29 for (String infix in infixes) {
18 int index = text.indexOf(infix, start); 30 int index = text.indexOf(infix, start);
19 if (index == -1) 31 if (index == -1)
20 throw "'$infix' not found in '$text' from offset ${start}."; 32 throw "'$infix' not found in '$text' from offset ${start}.";
21 result.add(text.substring(start, index)); 33 result.add(text.substring(start, index));
22 start = index + infix.length; 34 start = index + infix.length;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 if (argResults['verbose']) { 93 if (argResults['verbose']) {
82 LOG = true; 94 LOG = true;
83 } 95 }
84 if (argResults['cache'] != null) { 96 if (argResults['cache'] != null) {
85 cache.base = Uri.base.resolve('${argResults['cache']}/'); 97 cache.base = Uri.base.resolve('${argResults['cache']}/');
86 } 98 }
87 if (argResults['no-cache']) { 99 if (argResults['no-cache']) {
88 cache.base = null; 100 cache.base = null;
89 } 101 }
90 } 102 }
OLDNEW
« no previous file with comments | « tools/gardening/bin/summary.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698