diff --git a/src/engraving/dom/chordlist.cpp b/src/engraving/dom/chordlist.cpp index 29da82903e278..412bb6d9f77df 100644 --- a/src/engraving/dom/chordlist.cpp +++ b/src/engraving/dom/chordlist.cpp @@ -1784,8 +1784,7 @@ void ChordList::write(XmlWriter& xml) const if (s.code.isNull()) { xml.tag("sym", { { "name", s.name }, { "value", s.value } }); } else { - // write hex numbers with a "0x" prefix, so they can convert back properly on read - xml.tag("sym", { { "name", s.name }, { "code", u"0x" + String::number(s.code.unicode(), 16) } }); + xml.tag("sym", { { "name", s.name }, { "code", String::number(s.code.unicode(), 16) } }); } } } diff --git a/src/engraving/dom/page.cpp b/src/engraving/dom/page.cpp index cc89e3ccd6d61..a63654c8fd153 100644 --- a/src/engraving/dom/page.cpp +++ b/src/engraving/dom/page.cpp @@ -417,7 +417,7 @@ String Page::replaceTextMacros(const String& s) const } else { int rev = score()->mscoreRevision(); if (rev > 99999) { // MuseScore 1.3 is decimal 5702, 2.0 and later uses a 7-digit hex SHA - d += String::number(rev, 16); + d += String::number(rev, 16).remove(u"0x"); } else { d += String::number(rev, 10); } diff --git a/src/framework/global/types/string.cpp b/src/framework/global/types/string.cpp index 5b546d7149f63..dcec54a2f8db0 100644 --- a/src/framework/global/types/string.cpp +++ b/src/framework/global/types/string.cpp @@ -1265,11 +1265,22 @@ unsigned int String::toUInt(bool* ok, int base) const String String::number(int n, int base) { std::stringstream stream; - if (base == 16) { - stream << std::hex; + switch (base) { + case 16: stream << std::hex; + break; + case 10: stream << std::dec; + break; + case 8: stream << std::oct; + break; } stream << n; - std::string s = stream.str(); + std::string s = stream.str(); + switch (base) { + case 16: s = "0x" + s; + break; + case 8: s = "0" + s; + break; + } return fromAscii(s.c_str(), s.size()); }