summaryrefslogtreecommitdiffstats
path: root/base/string_util.h
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Make IsStringUTF8 reject (U+FDD0 .. U+FDEF) jschuh@google.com2010-02-261-1/+0
| | | | | | | | | | | Eliminated the old Mozilla implementation and used an ICU-based implementation. BUG=2759 TEST=base_unittests --gtest_filter=StringUtilTest.IsStringUTF8 Review URL: http://codereview.chromium.org/661205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40178 0039d316-1c4b-4281-b951-d872f2087c98
* This CL addresses 2 issues:jcampan@chromium.org2010-02-101-0/+7
| | | | | | | | | | | | | | | | - we were not computing the max request text size correctly in some cases (by forgetting the size of the &q= string) causing assertions. - the translate server might send inconsistent response in some cases, this CL makes sure we deal with them. A common case is when sending separators only strings, which we are not doing now anymore. Other more complicated case are less clear. BUG=35055 TEST=Visit www.spiegel.de and translate the page. The page should be translated correctly. Review URL: http://codereview.chromium.org/594023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38637 0039d316-1c4b-4281-b951-d872f2087c98
* Implement RemoveChars, a function to remove a list of characters from a ↵jhawkins@chromium.org2010-02-051-0/+13
| | | | | | | | | | string, and use it in PhoneNumber to remove extra phone number characters. BUG=none TEST=StringUtilTest.RemoveChars Review URL: http://codereview.chromium.org/572015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38162 0039d316-1c4b-4281-b951-d872f2087c98
* Move two generic string split functions from sync API to their own API in ↵timsteele@google.com2010-01-211-0/+2
| | | | | | | | | | | | | | base/string_split. BUG=None TEST=base_unittests Original patch by Thiago Farina Original Review: http://codereview.chromium.org/464075 Review URL: http://codereview.chromium.org/502074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36774 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 36459 - Breaks 7 WebKit testsjschuh@chromium.org2010-01-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | Changes are: * base::IsValidCodepoint() now returns false on noncharacter code points. * base::IsStringUTF8() now uses ICU library (removed old Mozilla implementation). * Removed base::IsStringWideUTF8() (was unused and confusing) * file_util::ReplaceIllegalCharactersInPath() now treats Unicode replacement character (U+FFFD) as invalid. * Associated unit tests updated. BUG=2759 BUG=30662 TEST=base_unittests gtest_filter=StringUtilTest.IsStringUTF8 TEST=base_unittests gtest_filter=UTFStringConversionsTest.* TEST=base_unittests gtest_filter=FileUtilICUTestReplaceIllegalCharactersInPathTest Review URL: http://codereview.chromium.org/548017 TBR=jschuh@chromium.org Review URL: http://codereview.chromium.org/552026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36460 0039d316-1c4b-4281-b951-d872f2087c98
* Changes are:jschuh@chromium.org2010-01-161-1/+0
| | | | | | | | | | | | | | | | | * base::IsValidCodepoint() now returns false on non-character code points. * base::IsStringUTF8() now uses ICU library (removed old Mozilla implementation). * Removed base::IsStringWideUTF8() (was unused and confusing) * file_util::ReplaceIllegalCharactersInPath() now treats Unicode replacement character (U+FFFD) as invalid. * Associated unit tests updated. BUG=2759 BUG=30662 TEST=base_unittests --gtest_filter=StringUtilTest.IsStringUTF8 TEST=base_unittests --gtest_filter=UTFStringConversionsTest.* TEST=base_unittests --gtest_filter=FileUtilICUTestReplaceIllegalCharactersInPathTest Review URL: http://codereview.chromium.org/548017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36459 0039d316-1c4b-4281-b951-d872f2087c98
* This CL contains the back-end implementation of the translate feature. It ↵jcampan@chromium.org2010-01-141-2/+10
| | | | | | | | | | | | | adds a Translate method to the renderer. On invocation this method triggers a traversal of the DOM page to retrieve the text nodes. The text node contents are then sent to the browser for actual translation (at this point, we just up-case the text for testing purpose). The browser sends back the translated text to the renderer that replace the DOM text node values with the translated text. BUG=None TEST=Run the unit-tests. Review URL: http://codereview.chromium.org/547013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36258 0039d316-1c4b-4281-b951-d872f2087c98
* Mac: UI tweaks for task manager.thakis@chromium.org2010-01-131-9/+7
| | | | | | | | | | | | | | | | | | | | | | | Nib change: Reduce row height, make scrollbars smaller. Make text in task manager table slightly smaller. Show in decimal digit for %cpu. Show memory in KB/MB, not always in K. Change update frequency from 1s to 2s to match Activity Monitor's default. (all mac-only. ui team is fine with this.) Finally, turn taskman on. BUG=13156 TEST=Open task manager, look at it. Should look & feel similar to Activity Monitor. Review URL: http://codereview.chromium.org/536038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36096 0039d316-1c4b-4281-b951-d872f2087c98
* Remove most uses of EmptyString(), EmptyWString(), EmptyString16(), and ↵pkasting@chromium.org2010-01-081-4/+9
| | | | | | | | | | EmptyGURL(), since the code in question can just use the default constructor. BUG=none TEST=none Review URL: http://codereview.chromium.org/517054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35766 0039d316-1c4b-4281-b951-d872f2087c98
* Implement ContactInfo, the FormGroup that stores contact information.jhawkins@chromium.org2010-01-041-1/+14
| | | | | | | | BUG=none TEST=StringUtilTest.Tokenizer Review URL: http://codereview.chromium.org/502103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35475 0039d316-1c4b-4281-b951-d872f2087c98
* Add StringPrintV, fix libxml_utils.cc to use itpiman@chromium.org2009-12-081-0/+3
| | | | | | Review URL: http://codereview.chromium.org/464064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34029 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes to the string MatchPattern functions:tony@chromium.org2009-12-031-4/+3
| | | | | | | | | | | | | | | 1) Make it explicit that it only supports ASCII (since it iterates character by character). 2) Limit the recursion to 16 levels. We could allow more, but in the case of a ?, it has exponential complexity, so I figured 16 was a good stopping point. It seems rare that someone would have more than 16 '?' and '*'s. BUG=28645 Review URL: http://codereview.chromium.org/460047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33748 0039d316-1c4b-4281-b951-d872f2087c98
* Ignore UTF-8's BOM when parsing userscript's metadata.hayato@chromium.org2009-11-251-0/+2
| | | | | | | | | BUG=27333 TEST=UserScriptTest and check the issue does not happen against userscipt encoded in UTF-8 with BOM.. Review URL: http://codereview.chromium.org/420001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33048 0039d316-1c4b-4281-b951-d872f2087c98
* Add compiler-specific "examine printf format" attributes to printfs.evan@chromium.org2009-11-201-10/+26
| | | | | | | | | | | | Functions that take a printf-style format get a new annotation, which produces a bunch of compiler warnings when you use printf impoperly. This change adds the annotations and fixes the warnings. We now must use PRId64 for 64-bit numbers and the PRIsz for size_t. Review URL: http://codereview.chromium.org/339059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32600 0039d316-1c4b-4281-b951-d872f2087c98
* Add first class support for user scripts.aa@chromium.org2009-11-041-0/+3
| | | | | | | | | | | | Original review: http://codereview.chromium.org/340057 TBR=mpcomplete@chromium.org BUG=22103 TEST=Install a user script (such as from userscripts.org). You should get the extension install UI and the script should show up in the extension management UI. It should also work, though some scripts use Firefox-specific APIs and those won't work in Chromium. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30925 0039d316-1c4b-4281-b951-d872f2087c98
* Convert ReplaceStringPlaceholders(std::string...) to take atony@chromium.org2009-10-291-1/+1
| | | | | | | | | | | | | | StringPiece as the format string instead. This allows us to save a string copy in the new tab page. Also clean up some code in the extensions process binding that was doing excess string conversions. BUG=26228 Review URL: http://codereview.chromium.org/347019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30491 0039d316-1c4b-4281-b951-d872f2087c98
* First parts of new FTP LIST response parsing code.phajdan.jr@chromium.org2009-10-281-0/+2
| | | | | | | | | | | Added parser for "ls" listing style, and tests. This is not yet used by the browser (will do that in a following CL). TEST=Covered by net_unittests. BUG=25520 Review URL: http://codereview.chromium.org/244008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30354 0039d316-1c4b-4281-b951-d872f2087c98
* Add more string16 variants.darin@chromium.org2009-10-191-0/+9
| | | | | | | | | | R=brettw BUG=none TEST=none Review URL: http://codereview.chromium.org/304003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29440 0039d316-1c4b-4281-b951-d872f2087c98