summaryrefslogtreecommitdiffstats
path: root/base/i18n/case_conversion.cc
blob: 5debc2ec8d662aec1cf347c293686bb1f7a59fbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (c) 2011 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/i18n/case_conversion.h"

#include "base/strings/string16.h"
#include "third_party/icu/source/common/unicode/unistr.h"

namespace base {
namespace i18n {

string16 ToLower(const StringPiece16& string) {
  icu::UnicodeString unicode_string(string.data(), string.size());
  unicode_string.toLower();
  return string16(unicode_string.getBuffer(), unicode_string.length());
}

string16 ToUpper(const StringPiece16& string) {
  icu::UnicodeString unicode_string(string.data(), string.size());
  unicode_string.toUpper();
  return string16(unicode_string.getBuffer(), unicode_string.length());
}

}  // namespace i18n
}  // namespace base