mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 14:07:01 -04:00
move reverse_string to string.hpp
This commit is contained in:
@@ -316,14 +316,6 @@ SCRIPT_FUNCTION(to_title) {
|
|||||||
SCRIPT_RETURN(capitalize(input.Lower()));
|
SCRIPT_RETURN(capitalize(input.Lower()));
|
||||||
}
|
}
|
||||||
|
|
||||||
String reverse_string(String const& input) {
|
|
||||||
// Note: std::reverse doesn't work because of unicode encoding stuff
|
|
||||||
String reversed;
|
|
||||||
for (auto it = input.rbegin(); it != input.rend(); ++it) {
|
|
||||||
reversed += *it;
|
|
||||||
}
|
|
||||||
return reversed;
|
|
||||||
}
|
|
||||||
// reverse a string
|
// reverse a string
|
||||||
SCRIPT_FUNCTION(reverse) {
|
SCRIPT_FUNCTION(reverse) {
|
||||||
SCRIPT_PARAM_C(String, input);
|
SCRIPT_PARAM_C(String, input);
|
||||||
|
|||||||
@@ -79,6 +79,15 @@ String replace_all(const String& heystack, const String& needle, const String& r
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String reverse_string(String const& input) {
|
||||||
|
// Note: std::reverse doesn't work because of unicode encoding stuff
|
||||||
|
String reversed;
|
||||||
|
for (auto it = input.rbegin(); it != input.rend(); ++it) {
|
||||||
|
reversed += *it;
|
||||||
|
}
|
||||||
|
return reversed;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Words
|
// ----------------------------------------------------------------------------- : Words
|
||||||
|
|
||||||
String last_word(const String& s) {
|
String last_word(const String& s) {
|
||||||
|
|||||||
@@ -132,6 +132,9 @@ String substr_replace(const String& input, size_t start, size_t end, const Strin
|
|||||||
/// Replace all occurences of one needle with replacement
|
/// Replace all occurences of one needle with replacement
|
||||||
String replace_all(const String& heystack, const String& needle, const String& replacement);
|
String replace_all(const String& heystack, const String& needle, const String& replacement);
|
||||||
|
|
||||||
|
/// Reverses a string, Note: std::reverse doesn't work with wxString
|
||||||
|
String reverse_string(String const& input);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Words
|
// ----------------------------------------------------------------------------- : Words
|
||||||
|
|
||||||
/// Returns the last word in a string
|
/// Returns the last word in a string
|
||||||
|
|||||||
Reference in New Issue
Block a user