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

Side by Side Diff: ios/web/string_util.cc

Issue 1544743002: Switch to standard integer types in ios/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « ios/web/shell/view_controller.mm ('k') | ios/web/string_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/web/public/string_util.h" 5 #include "ios/web/public/string_util.h"
6 6
7 #include <stddef.h>
8
7 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
8 10
9 namespace web { 11 namespace web {
10 12
11 base::string16 GetStringByClippingLastWord(const base::string16& contents, 13 base::string16 GetStringByClippingLastWord(const base::string16& contents,
12 size_t length) { 14 size_t length) {
13 if (contents.size() < length) 15 if (contents.size() < length)
14 return contents; 16 return contents;
15 17
16 base::string16 clipped_contents = contents.substr(0, length); 18 base::string16 clipped_contents = contents.substr(0, length);
17 size_t last_space_index = 19 size_t last_space_index =
18 clipped_contents.find_last_of(base::kWhitespaceUTF16); 20 clipped_contents.find_last_of(base::kWhitespaceUTF16);
19 // TODO(droger): Check if we should return the empty string instead. 21 // TODO(droger): Check if we should return the empty string instead.
20 // See http://crbug.com/324304 22 // See http://crbug.com/324304
21 if (last_space_index != base::string16::npos) 23 if (last_space_index != base::string16::npos)
22 clipped_contents.resize(last_space_index); 24 clipped_contents.resize(last_space_index);
23 return clipped_contents; 25 return clipped_contents;
24 } 26 }
25 27
26 } // namespace web 28 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/shell/view_controller.mm ('k') | ios/web/string_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698