23 */
24
25 #ifndef SHARE_UTILITIES_STRINGUTILS_HPP
26 #define SHARE_UTILITIES_STRINGUTILS_HPP
27
28 #include "memory/allocation.hpp"
29
30 class StringUtils : AllStatic {
31 public:
32 // Replace the substring <from> with another string <to>. <to> must be
33 // no longer than <from>. The input string is modified in-place.
34 //
35 // Replacement is done in a single pass left-to-right. So replace_no_expand("aaa", "aa", "a")
36 // will result in "aa", not "a".
37 //
38 // Returns the count of substrings that have been replaced.
39 static int replace_no_expand(char* string, const char* from, const char* to);
40
41 // Compute string similarity based on Dice's coefficient
42 static double similarity(const char* str1, size_t len1, const char* str2, size_t len2);
43 };
44
45 #endif // SHARE_UTILITIES_STRINGUTILS_HPP
|
23 */
24
25 #ifndef SHARE_UTILITIES_STRINGUTILS_HPP
26 #define SHARE_UTILITIES_STRINGUTILS_HPP
27
28 #include "memory/allocation.hpp"
29
30 class StringUtils : AllStatic {
31 public:
32 // Replace the substring <from> with another string <to>. <to> must be
33 // no longer than <from>. The input string is modified in-place.
34 //
35 // Replacement is done in a single pass left-to-right. So replace_no_expand("aaa", "aa", "a")
36 // will result in "aa", not "a".
37 //
38 // Returns the count of substrings that have been replaced.
39 static int replace_no_expand(char* string, const char* from, const char* to);
40
41 // Compute string similarity based on Dice's coefficient
42 static double similarity(const char* str1, size_t len1, const char* str2, size_t len2);
43
44 // Match a wildcarded class list to a proposed class name (in internal form).
45 // Commas separate multiple possible matches; stars are shell-style wildcards.
46 static bool class_list_match(const char* class_list, const char* class_name);
47 };
48
49 #endif // SHARE_UTILITIES_STRINGUTILS_HPP
|