summaryrefslogtreecommitdiffstats
path: root/base/string_util.cc
Commit message (Collapse)AuthorAgeFilesLines
* Implemented VLOG() et al.akalin@chromium.org2010-09-291-3/+4
| | | | | | | | | | | | | | 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
* base: Finish moving the SplitString functions from string_util.h to ↵tfarina@chromium.org2010-09-241-45/+0
| | | | | | | | | | | 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-20/+2
| | | | | | | | | 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
* Make the glob matcher support UTF8 strings.mnissler@chromium.org2010-09-101-41/+78
| | | | | | | | | | | 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-34/+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 an accordian effect to NTP.aa@chromium.org2010-08-311-1/+5
| | | | | | | | BUG=53248 Review URL: http://codereview.chromium.org/3250002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57966 0039d316-1c4b-4281-b951-d872f2087c98
* Convert FormatBytes to string16.evan@chromium.org2010-08-191-23/+23
| | | | | | | | | | 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
* Revert "Convert FormatBytes to string16."evan@chromium.org2010-08-181-23/+23
| | | | | | 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-23/+23
| | | | | | | | | | 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-157/+0
| | | | | | | | | | | | | | 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-503/+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
* Move ASCIIToWide and ASCIIToUTF16 to utf_string_conversions.h. I've found itbrettw@chromium.org2010-07-311-10/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* Made changes to TruncateUtF8ToByteSize to cleanup the code. jerrica@google.com2010-06-171-4/+5
| | | | | | | | | | | I made some corrections to my previously submitted function TruncateUTF8ToByteSize, in order to clean up the code, and use it to truncate sync node titles above 255 bytes. BUG=43675 TEST=base/string_util_unittest.cc Review URL: http://codereview.chromium.org/2632005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50112 0039d316-1c4b-4281-b951-d872f2087c98
* Add Tokenize() for StringPiece.mbelshe@chromium.org2010-06-021-0/+6
| | | | | | | | | 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/+35
| | | | | | | | | | | | | 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
* Use HttpRequestHeaders for extra_headers.willchan@chromium.org2010-04-201-14/+0
| | | | | | | | BUG=22588 Review URL: http://codereview.chromium.org/1604011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45096 0039d316-1c4b-4281-b951-d872f2087c98
* Rejigger how we format the display of bytes.evan@chromium.org2010-04-151-12/+6
| | | | | | | | | | | | | | | | | | | | | | | (Note that this does *not* touch the mega/mebi issue, despite my recent discussion of it.) What had been bugging me was that when downloading a file, you'd see it count up 10.7, 10.8, 10.9, *11*, 11.1. That is, previously when we rounded to displaying a trailing zero, we'd clip it off, which would make a download display like "11.1 / 50.2MB" jiggle to the left every time the trailing digit lined up. Now we try to always display three digits, which means we count up like 98.8, 98.9, *99.0*, 99.1, ... 99.9, 100, ... 101. This code is after fiddling the test into the shape I wanted it to be, then making the code produce that behavior. TEST=covered by unit test, updated with new expected behavior Review URL: http://codereview.chromium.org/1558025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44671 0039d316-1c4b-4281-b951-d872f2087c98
* Reland r42300: "HttpRequestHeaders refactor."willchan@chromium.org2010-03-291-0/+48
| | | | | | | | | 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-48/+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/+48
| | | | | | | | | | | | 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-48/+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/+48
| | | | | | | | | | | * 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
* Make IsStringUTF8 reject (U+FDD0 .. U+FDEF) jschuh@google.com2010-02-261-132/+12
| | | | | | | | | | | 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/+26
| | | | | | | | | | | | | | | | - 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
* linux: build with -Wextraevan@chromium.org2010-02-051-1/+19
| | | | | | | | | | | | 95% of this is removing "const" from return types, but turning this on found one bug! (A "for" loop that expected its iterator to go negative but which was using an unsigned type.) BUG=34160 Review URL: http://codereview.chromium.org/570012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38266 0039d316-1c4b-4281-b951-d872f2087c98
* Implement RemoveChars, a function to remove a list of characters from a ↵jhawkins@chromium.org2010-02-051-0/+39
| | | | | | | | | | 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
* Revert 36459 - Breaks 7 WebKit testsjschuh@chromium.org2010-01-161-12/+131
| | | | | | | | | | | | | | | | | | | | | | 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-131/+12
| | | | | | | | | | | | | | | | | * 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-0/+16
| | | | | | | | | | | | | 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-5/+5
| | | | | | | | | | | | | | | | | | | | | | | 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
* Make JoinString implementation match prototype.craig.schlenter@chromium.org2010-01-051-1/+1
| | | | | | | | | | This fixes the linux shared build. Error was: out/Release/lib.target/chrome/libbrowser.so: undefined reference to `JoinString(std::vector<std::basic_string<unsigned short, base::string16_char_traits, std::allocator<unsigned short> >, std::allocator<std::basic_string<unsigned short, base::string16_char_traits, std::allocator<unsigned short> > > > const&, unsigned short)' Review URL: http://codereview.chromium.org/518037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35533 0039d316-1c4b-4281-b951-d872f2087c98
* Implement ContactInfo, the FormGroup that stores contact information.jhawkins@chromium.org2010-01-041-8/+46
| | | | | | | | 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/+6
| | | | | | 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-8/+13
| | | | | | | | | | | | | | | 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 64bit supportgregoryd@google.com2009-11-061-9/+9
| | | | | | | | This CL is part of a larger effort to add support for Native Client on 64-bit Windows. Review URL: http://codereview.chromium.org/360034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31321 0039d316-1c4b-4281-b951-d872f2087c98
* Add first class support for user scripts.aa@chromium.org2009-11-041-0/+5
| | | | | | | | | | | | 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-10/+8
| | | | | | | | | | | | | | 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
* Add more string16 variants.darin@chromium.org2009-10-191-0/+29
| | | | | | | | | | 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
* Add string16 support for LowerCaseEqualsASCII, StartsWith, and EndsWith.darin@chromium.org2009-10-151-10/+56
| | | | | | | | | | R=mpcomplete BUG=none TEST=none Review URL: http://codereview.chromium.org/274067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29209 0039d316-1c4b-4281-b951-d872f2087c98
* Re-attempt r28993darin@chromium.org2009-10-141-28/+57
| | | | | | | | | | | | | | Add string16 support for TrimString, TrimWhitespace, and CollapseWhitespace. Also adds kWhitespaceUTF16. R=brettw BUG=none TEST=none Review URL: http://codereview.chromium.org/275019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29012 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 28993.darin@chromium.org2009-10-141-57/+28
| | | | | | Review URL: http://codereview.chromium.org/267100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28994 0039d316-1c4b-4281-b951-d872f2087c98
* Add string16 support for TrimString, TrimWhitespace, and CollapseWhitespace.darin@chromium.org2009-10-141-28/+57
| | | | | | | | | | | | Also adds kWhitespaceUTF16. R=brettw BUG=none TEST=none Review URL: http://codereview.chromium.org/267098 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28993 0039d316-1c4b-4281-b951-d872f2087c98
* Remove the dependency on i18n/icu_string_conversions from base/string_util.h.brettw@chromium.org2009-10-101-1/+0
| | | | | | | | | | | | Fix up all files requireing this header to include it directly. Split out the ICU-dependent string util unit tests into a new file base/i18n/icu_string_util_unittest.cc TEST=none BUG=none Review URL: http://codereview.chromium.org/269034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28674 0039d316-1c4b-4281-b951-d872f2087c98
* Implement the missing memory information functions that memory_test uses.vandebo@chromium.org2009-10-081-2/+12
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/266009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28486 0039d316-1c4b-4281-b951-d872f2087c98
* Add a version of ReplaceStringPlaceholders that operates on std::stringtony@chromium.org2009-09-291-6/+19
| | | | | | | | | | | | | | instead of string16. BUG=none TEST=base unit tests Original patch by avd@google.com at: http://codereview.chromium.org/245046 Review URL: http://codereview.chromium.org/242061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27532 0039d316-1c4b-4281-b951-d872f2087c98
* Move StringPiece into the base namespace. It is collidingtony@chromium.org2009-09-101-4/+4
| | | | | | | | | | with the StringPiece class in icu4.2, which is a problem when trying to use the system version of icu. Review URL: http://codereview.chromium.org/193072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25920 0039d316-1c4b-4281-b951-d872f2087c98
* Strip .plugin off of Mac plugin names when showing the crash info bar.stuartmorgan@google.com2009-09-041-0/+16
| | | | | | | | | BUG=21029 TEST=Kill a plugin process; the plugin crash info bar shouldn't have ".plugin" in the plugin name. Review URL: http://codereview.chromium.org/197018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25487 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a bug where we reused a va_list across multiple calls.deanm@chromium.org2009-08-241-9/+9
| | | | | | | | | | | The problem is that va_arg modifies the va_list so that the next call to va_arg returns the next argument. It looks like this code had attempted to not reuse the list by making a copy, but it passed the original instead of the copy. Review URL: http://codereview.chromium.org/174342 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24134 0039d316-1c4b-4281-b951-d872f2087c98
* Print more info in IsStringASCII assertions.phajdan.jr@chromium.org2009-08-201-4/+4
| | | | | | | | | | | This will help debugging when you have only the logs. TEST=none BUG=none Review URL: http://codereview.chromium.org/174110 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23900 0039d316-1c4b-4281-b951-d872f2087c98