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

Side by Side Diff: third_party/WebKit/Source/wtf/text/WTFString.h

Issue 1845363003: String replaceWithLiteral should just use strlen, also rename to replace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another NUL fix. Created 4 years, 8 months 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
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 m_impl = m_impl->replace(a.impl(), b.impl()); 313 m_impl = m_impl->replace(a.impl(), b.impl());
314 return *this; 314 return *this;
315 } 315 }
316 String& replace(unsigned index, unsigned len, const String& b) 316 String& replace(unsigned index, unsigned len, const String& b)
317 { 317 {
318 if (m_impl) 318 if (m_impl)
319 m_impl = m_impl->replace(index, len, b.impl()); 319 m_impl = m_impl->replace(index, len, b.impl());
320 return *this; 320 return *this;
321 } 321 }
322 322
323 template<unsigned charactersCount> 323 ALWAYS_INLINE String& replace(UChar a, const char* characters)
324 ALWAYS_INLINE String& replaceWithLiteral(UChar a, const char (&characters)[c haractersCount])
325 { 324 {
325 ASSERT(characters);
326 if (m_impl) 326 if (m_impl)
327 m_impl = m_impl->replace(a, characters, charactersCount - 1); 327 m_impl = m_impl->replace(a, characters, strlen(characters));
328
329 return *this; 328 return *this;
330 } 329 }
331 330
332 void fill(UChar c) 331 void fill(UChar c)
333 { 332 {
334 if (m_impl) 333 if (m_impl)
335 m_impl = m_impl->fill(c); 334 m_impl = m_impl->fill(c);
336 } 335 }
337 336
338 void ensure16Bit(); 337 void ensure16Bit();
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 using WTF::charactersToFloat; 704 using WTF::charactersToFloat;
706 using WTF::equal; 705 using WTF::equal;
707 using WTF::equalIgnoringCase; 706 using WTF::equalIgnoringCase;
708 using WTF::find; 707 using WTF::find;
709 using WTF::isAllSpecialCharacters; 708 using WTF::isAllSpecialCharacters;
710 using WTF::isSpaceOrNewline; 709 using WTF::isSpaceOrNewline;
711 using WTF::reverseFind; 710 using WTF::reverseFind;
712 711
713 #include "wtf/text/AtomicString.h" 712 #include "wtf/text/AtomicString.h"
714 #endif // WTFString_h 713 #endif // WTFString_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/text/UnicodeUtilities.cpp ('k') | third_party/WebKit/Source/wtf/text/WTFStringTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698