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

Side by Side Diff: icu46/source/common/unistr_props.cpp

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « icu46/source/common/unistr_cnv.cpp ('k') | icu46/source/common/unorm.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 1999-2007, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: unistr_props.cpp
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:2
12 *
13 * created on: 2004aug25
14 * created by: Markus W. Scherer
15 *
16 * Character property dependent functions moved here from unistr.cpp
17 */
18
19 #include "unicode/utypes.h"
20 #include "unicode/uchar.h"
21 #include "unicode/unistr.h"
22
23 U_NAMESPACE_BEGIN
24
25 UnicodeString&
26 UnicodeString::trim()
27 {
28 if(isBogus()) {
29 return *this;
30 }
31
32 UChar *array = getArrayStart();
33 UChar32 c;
34 int32_t oldLength = this->length();
35 int32_t i = oldLength, length;
36
37 // first cut off trailing white space
38 for(;;) {
39 length = i;
40 if(i <= 0) {
41 break;
42 }
43 U16_PREV(array, 0, i, c);
44 if(!(c == 0x20 || u_isWhitespace(c))) {
45 break;
46 }
47 }
48 if(length < oldLength) {
49 setLength(length);
50 }
51
52 // find leading white space
53 int32_t start;
54 i = 0;
55 for(;;) {
56 start = i;
57 if(i >= length) {
58 break;
59 }
60 U16_NEXT(array, i, length, c);
61 if(!(c == 0x20 || u_isWhitespace(c))) {
62 break;
63 }
64 }
65
66 // move string forward over leading white space
67 if(start > 0) {
68 doReplace(0, start, 0, 0, 0);
69 }
70
71 return *this;
72 }
73
74 U_NAMESPACE_END
OLDNEW
« no previous file with comments | « icu46/source/common/unistr_cnv.cpp ('k') | icu46/source/common/unorm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698