From a99d9e3a12828a6cdb60a41e840a557ca251efee Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Tue, 4 Feb 2025 21:18:39 +0100 Subject: [PATCH] Clean SWWMUtility.SuperscriptNum up a bit (even though it's not used). --- language.version | 4 ++-- zscript/utility/swwm_utility_string.zsc | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/language.version b/language.version index b3477723a..55238ab03 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1173 \cu(mar 04 feb 2025 10:31:35 CET)\c-"; -SWWM_SHORTVER="\cw1.3pre r1173 \cu(2025-02-04 10:31:35)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1174 \cu(mar 04 feb 2025 21:18:39 CET)\c-"; +SWWM_SHORTVER="\cw1.3pre r1174 \cu(2025-02-04 21:18:39)\c-"; diff --git a/zscript/utility/swwm_utility_string.zsc b/zscript/utility/swwm_utility_string.zsc index e386406c6..05797c706 100644 --- a/zscript/utility/swwm_utility_string.zsc +++ b/zscript/utility/swwm_utility_string.zsc @@ -73,14 +73,18 @@ extend Class SWWMUtility { // unicode is fun static const int digs[] = {0x2070,0x00B9,0x00B2,0x00B3,0x2074,0x2075,0x2076,0x2077,0x2078,0x2079}; - String str = ""; - int digits = int(Log10(val)); - for ( int i=digits; i>=0; i-- ) + String str = String.Format("%d",val); + int len = str.CodePointCount(); + String newstr = ""; + for ( int i=0, pos=0; i= 0x0030) || (ch <= 0x0039) ) newstr.AppendCharacter(digs[ch-0x0030]); + else if ( ch == 0x002D ) newstr.AppendCharacter(0x207A); // minus + // everything else gets ignored } - return str; + return newstr; } static void ObscureText( String &str, int seed, bool alnum = false, bool minihud = false )