1// Copyright 2016 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5final RegExp _whitespaceRegex = RegExp(r'\s+'); 6 7String cleanAdbDeviceName(String name) { 8 // Some emulators use `___` in the name as separators. 9 name = name.replaceAll('___', ', '); 10 11 // Convert `Nexus_7` / `Nexus_5X` style names to `Nexus 7` ones. 12 name = name.replaceAll('_', ' '); 13 14 name = name.replaceAll(_whitespaceRegex, ' ').trim(); 15 16 return name; 17} 18