Chromium Code Reviews| Index: base/strings/string_util.cc |
| diff --git a/base/strings/string_util.cc b/base/strings/string_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fa985c0ad7e25afd040b0436fdcb05703978c877 |
| --- /dev/null |
| +++ b/base/strings/string_util.cc |
| @@ -0,0 +1,23 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/strings/string_util.h" |
| + |
| +namespace base { |
| + |
| +bool IsStringASCII(const StringPiece& str) { |
| + for (size_t i = 0; i < str.length(); ++i) |
|
scottmg
2015/05/04 23:15:33
The Chromium implementation of these is surprising
|
| + if (str.data()[i] >= 0x80) |
| + return false; |
| + return true; |
| +} |
| + |
| +bool IsStringASCII(const StringPiece16& str) { |
| + for (size_t i = 0; i < str.length(); ++i) |
| + if (str.data()[i] >= 0x80) |
| + return false; |
| + return true; |
| +} |
| + |
| +} // namespace base |