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

Side by Side Diff: ios/chrome/common/string_util.h

Issue 1066013003: Revert of Upstream string_util function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/chrome/common/README.txt ('k') | ios/chrome/common/string_util.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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
5 #ifndef IOS_CHROME_COMMON_STRING_UTIL_H_
6 #define IOS_CHROME_COMMON_STRING_UTIL_H_
7
8 #import <CoreGraphics/CoreGraphics.h>
9 #import <Foundation/Foundation.h>
10 #include <string>
11
12 // Parses a string with an embedded link inside, delineated by BEGIN_LINK and
13 // END_LINK. Returns the string without the link delimiters. If |out_link_range|
14 // is not null, then it is filled out with the range of the link in the returned
15 // string.
16 // If no link is found, then it returns |text| and sets |out_link_range| to
17 // {NSNotFound, 0}.
18 NSString* ParseStringWithLink(NSString* text, NSRange* out_link_range);
19
20 // Utility method that returns an NSCharacterSet containing Unicode graphics
21 // and drawing characters (but not including the Braille Patterns characters).
22 NSCharacterSet* GraphicCharactersSet();
23
24 // Cleans an NSString by collapsing whitespace and (if |trim| is true)
25 // removing leading and trailing spaces. If |removeGraphicChars| is true,
26 // unicode graphic characters will also be removed from the string.
27 NSString* CleanNSStringForDisplay(NSString* dirty,
28 BOOL removeGraphicChars,
29 BOOL trim);
30
31 // Cleans a std::string identically to CleanNSStringForDisplay()
32 std::string CleanStringForDisplay(std::string dirty,
33 BOOL removeGraphicChars,
34 BOOL trim);
35
36 // Find the longest leading substring of |string| that, when rendered with
37 // |attributes|, will fit on a single line inside |targetWidth|. If |trailing|
38 // is YES, then find the trailing (instead of leading) substring.
39 NSString* SubstringOfWidth(NSString* string,
40 NSDictionary* attributes,
41 CGFloat targetWidth,
42 BOOL trailing);
43
44 #endif // IOS_CHROME_COMMON_STRING_UTIL_H_
OLDNEW
« no previous file with comments | « ios/chrome/common/README.txt ('k') | ios/chrome/common/string_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698