summaryrefslogtreecommitdiffstats
path: root/base/string_util.h
Commit message (Collapse)AuthorAgeFilesLines
* ake string_util::WriteInto() DCHECK() that the supplied |length_with_null| > ↵pkasting@chromium.org2011-11-291-27/+19
| | | | | | | | | | | | 1, meaning that the without-'\0' string is non-empty. This replaces the conditional code added recently that makes this case return NULL. It's easier to understand if it's simply an error to call WriteInto() in this case at all. Add DCHECK()s or conditionals as appropriate to callers in order to ensure this assertion holds. BUG=none TEST=none Review URL: http://codereview.chromium.org/8418034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112005 0039d316-1c4b-4281-b951-d872f2087c98
* Fix AutocompleteMatch DCHECK() triggered by ↵asvitkine@chromium.org2011-11-101-5/+19
| | | | | | | | | | | | | | | | | | | |RenderViewContextMenu::AppendSearchProvider()|. Makes |AppendSearchProvider()| sanitize the text by replacing unwanted whitespace characters with spaces. Do this instead of calling |AutocompleteMatch::SanitizeString()|, since we want to preserve the whitespace between words separated by newlines here, rather than appending such words together. Added |ReplaceChars()| to base/string_util to support replacing any occurence of the given characters with a replacement string. BUG=103338 TEST=Right click on multiline text in a text area in a Debug build. A DCHECK() shouldn't trigger. Review URL: http://codereview.chromium.org/8502027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109430 0039d316-1c4b-4281-b951-d872f2087c98
* Clarify comments for |RemoveChars()| and |TrimString()| that the char array ↵asvitkine@chromium.org2011-10-251-3/+4
| | | | | | | | | | | param must be null terminated. TEST=none BUG=none Review URL: http://codereview.chromium.org/8396009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107198 0039d316-1c4b-4281-b951-d872f2087c98
* WriteInto handles length_with_null values of 1 better.cbentzel@chromium.org2011-10-181-13/+27
| | | | | | | | | | | | | | | | In debug builds on VS2010, the old code triggered a debug assertion in xstring, since [0] was being accessed and the size of the array was 0. A |length_with_null| of 1 is considered a valid use of this function, so an alternate implementation is used which returns the data() pointer. BUG=None TEST=net_unittests --gtest_filter=*Digest* on debug on VS2010 works. Review URL: http://codereview.chromium.org/8143001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106062 0039d316-1c4b-4281-b951-d872f2087c98
* base: Fix the TODO in string_util.htfarina@chromium.org2011-08-171-5/+0
| | | | | | | | | | | | | This removes the include of stringprintf.h from string_util.h and fix the clients. BUG=None TEST=None R=evan@chromium.org Review URL: http://codereview.chromium.org/7633055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97067 0039d316-1c4b-4281-b951-d872f2087c98
* Rename BASE_API to BASE_EXPORT.darin@chromium.org2011-08-051-137/+145
| | | | | | | R=rvargas Review URL: http://codereview.chromium.org/7461141 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95618 0039d316-1c4b-4281-b951-d872f2087c98
* Upstream android debug and log related filesmichaelbai@google.com2011-07-071-0/+1
| | | | | | | | | BUG= TEST= Review URL: http://codereview.chromium.org/7238012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91748 0039d316-1c4b-4281-b951-d872f2087c98
* Localize strings, speeds.avi@chromium.org2011-06-221-25/+5
| | | | | | | | | BUG=86527 TEST=run in non-English. For European languages, during a download the decimal separators should be commas (e.g. "0,0 MB"). (The speeds are in strings files and might take a little time to run through the translation machinery.) Review URL: http://codereview.chromium.org/7189076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90092 0039d316-1c4b-4281-b951-d872f2087c98
* wstring: remove wstring version of RemoveCharsevan@chromium.org2011-05-171-3/+0
| | | | | | | | BUG=23581 Review URL: http://codereview.chromium.org/7037014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85672 0039d316-1c4b-4281-b951-d872f2087c98
* wstring: remove wstring version of TrimWhitespaceevan@chromium.org2011-05-101-3/+0
| | | | | | | | | | And fix the one caller. BUG=23581 Review URL: http://codereview.chromium.org/6932056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84806 0039d316-1c4b-4281-b951-d872f2087c98
* Base: More adjustments to BASE_API and project dependencies torvargas@google.com2011-04-211-11/+10
| | | | | | | | | | use base.dll from chrome. BUG=76996 TEST=none Review URL: http://codereview.chromium.org/6877053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82564 0039d316-1c4b-4281-b951-d872f2087c98
* Base: First pass at having base.dll: definition ofrvargas@google.com2011-03-221-150/+157
| | | | | | | | | | BASE_API and a few files that use it. BUG=76996 TEST=none Review URL: http://codereview.chromium.org/6725001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79056 0039d316-1c4b-4281-b951-d872f2087c98
* Typo fix.avi@chromium.org2011-01-041-2/+2
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/6049009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70433 0039d316-1c4b-4281-b951-d872f2087c98
* Move ElideString() from base/string_util.cc to app/text_elider.cc to jschuh@google.com2010-12-171-8/+0
| | | | | | | | | | | | | reduce size of widely-included base libraries. Committing for tsepez. BUG=49747 TEST=TextEliderTest.* Review URL: http://codereview.chromium.org/6017001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69555 0039d316-1c4b-4281-b951-d872f2087c98
* Move ToUpperASCII into base namespace, to make it consistent with ToLowerASCIIjoth@chromium.org2010-11-161-7/+7
| | | | | | | | | | | This mirrors the change made in http://src.chromium.org/viewvc/chrome?view=rev&revision=64879 BUG=None TEST=everything builds; base unit tests pass Review URL: http://codereview.chromium.org/5007001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66261 0039d316-1c4b-4281-b951-d872f2087c98
* base: Move StringSplitAlongWhitespace to string_split.htfarina@chromium.org2010-11-151-16/+0
| | | | | | | | | BUG=None TEST=trybots Review URL: http://codereview.chromium.org/5004002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66181 0039d316-1c4b-4281-b951-d872f2087c98
* Fix clang build by moving ToLowerASCII into base namespace.tfarina@chromium.org2010-11-031-7/+7
| | | | | | | | | BUG=None TEST=trybots Review URL: http://codereview.chromium.org/4371001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64879 0039d316-1c4b-4281-b951-d872f2087c98
* base: Move CaseInsensitiveCompare traits into the base namespace.tfarina@chromium.org2010-11-031-17/+18
| | | | | | | | | | | | | | | This should fix conflicts like: 2>d:\src\chromium_src2\src\base/string_util.h(480) : error C2904: 'CaseInsensitiveCompare' : name already used for a template in the current scope 2> d:\src\chromium_src2\src\third_party\xulrunner-sdk\win\include\xpcom\nsStringAPI.h(1406) : see declaration of 'CaseInsensitiveCompare' Reported-by: Jeff Timanus <twiz@google.com> BUG=None TEST=trybots Review URL: http://codereview.chromium.org/4366001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64877 0039d316-1c4b-4281-b951-d872f2087c98
* Roll DEPS for rlz library r25:26.tfarina@chromium.org2010-10-151-7/+0
| | | | | | | | | | | | This should get the latest fix in rlz library that includes string_split.h and append base:: at the call of SplitString, so we can remove the hack in string_util.h BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3828001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62696 0039d316-1c4b-4281-b951-d872f2087c98
* base: remove various unused string utility functionsevan@chromium.org2010-10-141-2/+0
| | | | | | | | TEST=trybots Review URL: http://codereview.chromium.org/3753003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62580 0039d316-1c4b-4281-b951-d872f2087c98
* base: Move SplitString functions into the base namespace and update the callers.tfarina@chromium.org2010-10-141-0/+1
| | | | | | | | | BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3750001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62483 0039d316-1c4b-4281-b951-d872f2087c98
* fixes issue 52839 (MatchPattern timeout)andybons@chromium.org2010-10-061-0/+1
| | | | | | | | | | | | | Fixes issue 52839 by converting consecutive wildcards (******) into one wildcard (*) in MatchPattern. BUG=52839 TEST=MatchPattern Original patch from issue 3608005 (Jon Stritar) Review URL: http://codereview.chromium.org/3551016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61644 0039d316-1c4b-4281-b951-d872f2087c98
* Implemented VLOG() et al.akalin@chromium.org2010-09-291-1/+2
| | | | | | | | | | | | | | Implemented VLOG(), VLOG_IF(), VLOG_IS_ON(). Added --v and --vmodule switches. Changed some spammy sync-related logs to use VLOG. BUG=56965 TEST=New unittests Review URL: http://codereview.chromium.org/3448028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60976 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the hack in string_util for RLZ library.tfarina@chromium.org2010-09-271-17/+0
| | | | | | | | | | | The rlz library was updated to include the right header from these string functions. BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3506003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60636 0039d316-1c4b-4281-b951-d872f2087c98
* base: Finish moving the SplitString functions from string_util.h to ↵tfarina@chromium.org2010-09-241-19/+6
| | | | | | | | | | | string_split.h BUG=None TEST=trybos Review URL: http://codereview.chromium.org/3447008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60422 0039d316-1c4b-4281-b951-d872f2087c98
* base: Move SplitStringDontTrim functions from string_util.h to string_split.htfarina@chromium.org2010-09-151-11/+0
| | | | | | | | | BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3366011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59493 0039d316-1c4b-4281-b951-d872f2087c98
* Bunch of match preview tweaks:sky@chromium.org2010-09-141-1/+1
| | | | | | | | | | | | | | | | . Makes MatchPreview owned by Browser rather than each TabContents. . Makes MatchPreview dismiss when the omnibox closes. . Supports the ability to send script to the page rather than reloading on every keystroke. . Supports receiving results from the page that drives the suggest text in the omnbox. BUG=54833 TEST=none Review URL: http://codereview.chromium.org/3332022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59428 0039d316-1c4b-4281-b951-d872f2087c98
* Make the glob matcher support UTF8 strings.mnissler@chromium.org2010-09-101-2/+2
| | | | | | | | | | | This generalizes the existing pattern matching code to support UTF8 strings. BUG=53158 TEST=string_util_unittests.cc Review URL: http://codereview.chromium.org/3295018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59071 0039d316-1c4b-4281-b951-d872f2087c98
* base: Move SplitStringUsingSubstr functions from string_util.h to string_split.htfarina@chromium.org2010-09-021-8/+0
| | | | | | | | | BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3284005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58300 0039d316-1c4b-4281-b951-d872f2087c98
* Add unit test for functionality added to ReplaceStringPlaceholders in r57966.aa@chromium.org2010-08-311-2/+3
| | | | | | | | TEST=base_unittests --gtest_filter=StringUtilTest.ReplaceStringPlaceholders* Review URL: http://codereview.chromium.org/3266013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58047 0039d316-1c4b-4281-b951-d872f2087c98
* Convert FormatBytes to string16.evan@chromium.org2010-08-191-3/+3
| | | | | | | | | | I considered ASCII, but it's producing what is intended to be a human-readable string. For example, in theory the "bytes/s" annotation could be localized into a language where the "b" is non-ASCII. Review URL: http://codereview.chromium.org/3107021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56771 0039d316-1c4b-4281-b951-d872f2087c98
* Remove forward declares for ASCIIToUTF16 from string_util. All callers now usebrettw@chromium.org2010-08-191-4/+11
| | | | | | | | | | utf_string_conversions.h TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3148019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56719 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Convert FormatBytes to string16."evan@chromium.org2010-08-181-3/+3
| | | | | | This reverts commit r56603. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56608 0039d316-1c4b-4281-b951-d872f2087c98
* Convert FormatBytes to string16.evan@chromium.org2010-08-181-3/+3
| | | | | | | | | | I considered ASCII, but it's producing what is intended to be a human-readable string. For example, in theory the "bytes/s" annotation could be localized into a language where the "b" is non-ASCII. Review URL: http://codereview.chromium.org/3107021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56603 0039d316-1c4b-4281-b951-d872f2087c98
* Move StringPrintf into its own file and use the base namespace. Currently ↵brettw@chromium.org2010-08-171-27/+5
| | | | | | | | | | | | | | this has using directives for the functions so I don't have to change all files to use the namespace. No code changes to logic. TEST=it compiles + the included unit tests BUG=none Review URL: http://codereview.chromium.org/3181016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56299 0039d316-1c4b-4281-b951-d872f2087c98
* Remove number conversion functions from string_util. These moved to ↵brettw@chromium.org2010-08-031-70/+0
| | | | | | | | | | string_number_conversions. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3054036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54747 0039d316-1c4b-4281-b951-d872f2087c98
* base: Add HexDigitToInt function to string_util.htfarina@chromium.org2010-07-311-0/+12
| | | | | | | | | | | | | Removed duplicated HexToInt functions and converted the callers along the way. BUG=None TEST=trybots and out/Debug/base_unittests --gtest_filter=StringUtilTest.HexDigitToInt Signed-off-by: Thiago Farina <tfarina@chromium.org> Review URL: http://codereview.chromium.org/2836069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54473 0039d316-1c4b-4281-b951-d872f2087c98
* Move ASCIIToWide and ASCIIToUTF16 to utf_string_conversions.h. I've found itbrettw@chromium.org2010-07-311-3/+12
| | | | | | | | | | | | | | | | | | | | | | | weird that UTF8ToWide is in utf_string_conversions, but ASCIIToWide is in string_util.h. This should help some dependencies since string_util changes much more frequently than utf_string_conversions and fewer files will now need string_utils. Since this requires a lot of changes, this keeps a forward-declaration in string_util so I can update the entire project incrementally. This change updates base and net only. I removed some includes of string_util from header files in net. In particular, url_request_context which involved creating a new .cc file to implement a function (already virtual so there's no speed penalty). It turns out a lot of files were getting string_util from this include, so I had to update a bunch of random files to now explicitly include string_util.h TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3076013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54456 0039d316-1c4b-4281-b951-d872f2087c98
* `#pragma once` for app, base, chrome, gfx, ipc, net, skia, viewsthakis@chromium.org2010-07-261-0/+1
| | | | | | | | | BUG=50273 TEST=everything still builds, build is 10% faster on windows, same speed on mac/linux TBR: erg git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53716 0039d316-1c4b-4281-b951-d872f2087c98
* base: Add IsHexDigit function to string_util.htfarina@chromium.org2010-07-231-0/+7
| | | | | | | | | | | | | | | Removed duplicated IsHex functions and converted the callers along the way. (Note: this was a TODO for jungshik). BUG=None TEST=trybots Signed-off-by: Thiago Farina <tfarina@chromium.org> Review URL: http://codereview.chromium.org/2870058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53428 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 49982 - patchthakis@chromium.org2010-06-161-6/+2
| | | | | | | TBR=thakis@chromium.org Review URL: http://codereview.chromium.org/2825006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50002 0039d316-1c4b-4281-b951-d872f2087c98
* patchthakis@chromium.org2010-06-161-2/+6
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49982 0039d316-1c4b-4281-b951-d872f2087c98
* Add Tokenize() for StringPiece.mbelshe@chromium.org2010-06-021-0/+3
| | | | | | | | | BUG=none TEST=StringUtilTest.TokenizeStringPiece Review URL: http://codereview.chromium.org/2463007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48792 0039d316-1c4b-4281-b951-d872f2087c98
* Add a method that truncates strings to the end point of a valid UTF8 ↵nick@chromium.org2010-05-281-0/+6
| | | | | | | | | | | | | character, leaving the string's size to be less than or equal to a specified byte size. BUG=43675 TEST=base/string_util_unittest.cc Patch contributed by to Jerrica Jones (jerrica@chromium.org). Review URL: http://codereview.chromium.org/2239007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48518 0039d316-1c4b-4281-b951-d872f2087c98
* Reland r42300: "HttpRequestHeaders refactor."willchan@chromium.org2010-03-291-0/+8
| | | | | | | | | Adds a fix and tests for empty header values. The particular bug happened when the value was non-empty, but was all LWS, so it was effectively empty. BUG=22588 Review URL: http://codereview.chromium.org/1370001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43000 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Reland r42300: "HttpRequestHeaders refactor."""willchan@chromium.org2010-03-231-8/+0
| | | | | | | | Broke another layout test. Review URL: http://codereview.chromium.org/1223001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42387 0039d316-1c4b-4281-b951-d872f2087c98
* Reland r42300: "HttpRequestHeaders refactor.""willchan@chromium.org2010-03-231-0/+8
| | | | | | | | | | | | This time, make sure HttpRequestHeaders::FindHeader() checks key lengths are equal. * Create HttpRequestHeaders. * Switch HttpNetworkTransaction to build request headers. TODO: Change extra_headers to use HttpRequestHeaders. BUG=22588 Review URL: http://codereview.chromium.org/1110014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42376 0039d316-1c4b-4281-b951-d872f2087c98
* Revert r42300: "HttpRequestHeaders refactor."willchan@chromium.org2010-03-231-8/+0
| | | | | | | | | Broke access-control-basic-whitelist-request-headers.html layout test. BUG=22588 Review URL: http://codereview.chromium.org/1110012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42305 0039d316-1c4b-4281-b951-d872f2087c98
* HttpRequestHeaders refactor.willchan@chromium.org2010-03-231-0/+8
| | | | | | | | | | | * Create HttpRequestHeaders. * Switch HttpNetworkTransaction to build request headers. TODO: Change extra_headers to use HttpRequestHeaders. BUG=22588 Review URL: http://codereview.chromium.org/1039001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42300 0039d316-1c4b-4281-b951-d872f2087c98
* chromeos: string_util.h -> utf_string_conversions.h fix.jhawkins@chromium.org2010-03-141-4/+0
| | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/851010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41539 0039d316-1c4b-4281-b951-d872f2087c98