iklam@7089: /* iklam@7089: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. iklam@7089: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. iklam@7089: * iklam@7089: * This code is free software; you can redistribute it and/or modify it iklam@7089: * under the terms of the GNU General Public License version 2 only, as iklam@7089: * published by the Free Software Foundation. iklam@7089: * iklam@7089: * This code is distributed in the hope that it will be useful, but WITHOUT iklam@7089: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or iklam@7089: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License iklam@7089: * version 2 for more details (a copy is included in the LICENSE file that iklam@7089: * accompanied this code). iklam@7089: * iklam@7089: * You should have received a copy of the GNU General Public License version iklam@7089: * 2 along with this work; if not, write to the Free Software Foundation, iklam@7089: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. iklam@7089: * iklam@7089: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA iklam@7089: * or visit www.oracle.com if you need additional information or have any iklam@7089: * questions. iklam@7089: * iklam@7089: */ iklam@7089: iklam@7089: #ifndef SHARE_VM_UTILITIES_STRINGUTILS_HPP iklam@7089: #define SHARE_VM_UTILITIES_STRINGUTILS_HPP iklam@7089: iklam@7089: #include "memory/allocation.hpp" iklam@7089: iklam@7089: class StringUtils : AllStatic { iklam@7089: public: iklam@7089: // Replace the substring with another string . must be iklam@7089: // no longer than . The input string is modified in-place. iklam@7089: // iklam@7089: // Replacement is done in a single pass left-to-right. So replace_no_expand("aaa", "aa", "a") iklam@7089: // will result in "aa", not "a". iklam@7089: // iklam@7089: // Returns the count of substrings that have been replaced. iklam@7089: static int replace_no_expand(char* string, const char* from, const char* to); iklam@7089: }; iklam@7089: iklam@7089: #endif // SHARE_VM_UTILITIES_STRINGUTILS_HPP