Add function UnescapeMenuString

Turns E&dit into Edit and 'd'. Double ampersands are translated to just a single one,
hence the unescaping part of this.

Useful in the Mac port to deal with desktop UI translation strings with included
Windows hotkeys.
This commit is contained in:
Henrik Rydgård
2023-04-23 14:36:34 +02:00
parent 3d7e73a37a
commit 91d4ded3fd
3 changed files with 49 additions and 0 deletions
+4
View File
@@ -76,6 +76,10 @@ void GetQuotedStrings(const std::string& str, std::vector<std::string>& output);
std::string ReplaceAll(std::string input, const std::string& src, const std::string& dest);
// Takes something like R&eplace and returns Replace, plus writes 'e' to *shortcutChar
// if not nullptr. Useful for Windows menu strings.
std::string UnescapeMenuString(const char *input, char *shortcutChar);
void SkipSpace(const char **ptr);
size_t truncate_cpy(char *dest, size_t destSize, const char *src);