OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/string_util.h" | 5 #include "base/string_util.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <ctype.h> | 9 #include <ctype.h> |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
903 subst.push_back(a); | 903 subst.push_back(a); |
904 string16 result = ReplaceStringPlaceholders(format_string, subst, &offsets); | 904 string16 result = ReplaceStringPlaceholders(format_string, subst, &offsets); |
905 | 905 |
906 DCHECK(offsets.size() == 1); | 906 DCHECK(offsets.size() == 1); |
907 if (offset) { | 907 if (offset) { |
908 *offset = offsets[0]; | 908 *offset = offsets[0]; |
909 } | 909 } |
910 return result; | 910 return result; |
911 } | 911 } |
912 | 912 |
913 bool StripJavascriptSchema(const string16& text, string16* out) { | |
914 const string16 kJsSchema(ASCIIToUTF16("javascript:")); | |
Avi (use Gerrit)
2011/05/10 23:41:06
Plus, when you move this out of base, like pkastin
Cris Neckar
2011/05/11 21:42:36
Done.
| |
915 bool changed = false; | |
916 *out = text; | |
917 while (StartsWith(*out, kJsSchema, false)) { | |
918 changed = true; | |
919 TrimWhitespace(out->substr(kJsSchema.length()), TRIM_LEADING, out); | |
920 } | |
921 return changed; | |
922 } | |
923 | |
913 static bool IsWildcard(base_icu::UChar32 character) { | 924 static bool IsWildcard(base_icu::UChar32 character) { |
914 return character == '*' || character == '?'; | 925 return character == '*' || character == '?'; |
915 } | 926 } |
916 | 927 |
917 // Move the strings pointers to the point where they start to differ. | 928 // Move the strings pointers to the point where they start to differ. |
918 template <typename CHAR, typename NEXT> | 929 template <typename CHAR, typename NEXT> |
919 static void EatSameChars(const CHAR** pattern, const CHAR* pattern_end, | 930 static void EatSameChars(const CHAR** pattern, const CHAR* pattern_end, |
920 const CHAR** string, const CHAR* string_end, | 931 const CHAR** string, const CHAR* string_end, |
921 NEXT next) { | 932 NEXT next) { |
922 const CHAR* escape = NULL; | 933 const CHAR* escape = NULL; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1088 } | 1099 } |
1089 | 1100 |
1090 } // namespace | 1101 } // namespace |
1091 | 1102 |
1092 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 1103 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
1093 return lcpyT<char>(dst, src, dst_size); | 1104 return lcpyT<char>(dst, src, dst_size); |
1094 } | 1105 } |
1095 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1106 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
1096 return lcpyT<wchar_t>(dst, src, dst_size); | 1107 return lcpyT<wchar_t>(dst, src, dst_size); |
1097 } | 1108 } |
OLD | NEW |