g | x | w | all
Bytes Lang Time Link
012Pip211213T171331ZDLosc
097AWK241107T172426Zxrs
013UiuaSBCS241022T073208ZEurope20
071Julia 1.0230224T194105ZAshlin H
053Python230225T140741ZThe Thon
nan230225T140325ZThe Thon
010Pyt230225T134814ZKip the
nanFig220910T014821ZSeggan
612Nibbles220907T105810ZDominic
007Vyxal211213T184817Zemanresu
040Prolog SWI220906T203346ZnaffetS
063Excel211214T162414ZEngineer
008Raku211213T142957Zovs
094Lua211219T065548ZVisckmar
027APOL211213T141117ZGinger
050Python 3.8 prerelease211213T141238Zrak1507
037Hexagony211215T042202ZJoundill
089Python 3211213T135242ZFmbalbue
060JavaScript211213T153712ZUnmitiga
013Factor211214T171425Zchunes
040Ruby211214T130724ZG B
051R211213T143016ZDominic
099Turing Machine Code211214T103631Zouflak
063Nim211214T102600ZAdam
015APL dzaima/APL211213T141735ZAdá
035PHP211214T094229ZKaddath
063C gcc with funsignedchar211214T090759ZErikF
009Husk211213T193824ZDominic
00805AB1E211213T154128ZKevin Cr
043JavaScript ES6211213T180322ZArnauld
007Jelly211213T235814Zlynn
075Haskell211213T220746ZBenji
007Japt m211213T215400ZShaggy
046C gcc211213T174035ZNoodle9
067Java211213T172529ZUnmitiga
020JavaScript211213T164644ZShaggy
019Retina 0.8.2211213T144619ZNeil
002Charcoal211213T143906ZNeil
053Python 3211213T140801ZAlan Bag
062Python 3211213T135532ZGinger

Pip, 9 12 bytes

+3 bytes to handle more stringent rules

+:A_%E#A_MJa

Attempt This Online!

Explanation

After some trial and error, I found a really nice property of these numbers' codepoints:

So all we need to do is take the codepoint of each digit mod 8 if it's 3 digits and mod 16 if it's 4 digits...

          a  First command-line argument
        MJ   Map this function to each character, joining the results together:
  A_          Codepoint of the character
    %         Mod
     E        2 to the power of
      #       Length of
       A_     Codepoint of the character
+:           Treat the resulting string as a number (removing leading 0s)

AWK, 97 bytes

{for(;i++<split("¹²³⁴⁵⁶⁷⁸⁹⁰",a);)b[a[i]]=i 
for(;j++<NF;)s=s b[$j]%10;print s*1}

Try it online!

{for(;i++<split("¹²³⁴⁵⁶⁷⁸⁹⁰",a);)b[a[i]]=i  # map
for(;j++<NF;)s=s b[$j]%10;                  # convert
print s*1}                                  # implicit convert to int
                                            # remove leading zeros

UiuaSBCS, 13 bytes

⋕+@0◿12◿92-@\0

Try it here!

Explanation

⋕+@0◿12◿92-@\0
          -@\0 Unicode codepoints
       ◿92     modulo 92
    ◿12        modulo 12
 +@0           convert numbers to digits
⋕              parse

Julia 1.0, 78 71 bytes

~x=parse(Int,join(Dict(["⁰¹²³"...;'⁴':'⁹'].=>0:9)[i] for i=x))

Try it online!

Python, 53 bytes

lambda s:int(''.join(str(x%12&x)for x in map(ord,s)))

Attempt This Online!

Port of Lynn's Jelly answer. Not the best Python answer (by 3 bytes), but uses a different method to the others.

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 bytes

OD12%z.A&ZD

Attempt This Online!

Port of Lynn's Jelly answer.

Explanation

OD12%z.A&ZD  # Implicit input
OD           # Get ordinals and duplicate
  12%        # Mod 12 of each
     z.      # Zip and apply to each pair:
       A&    #  Bitwise AND
         ZD  # Convert to integer
             # Implicit output

Pyt, 10 bytes

ą2Ĩ4+1ᴇ%ǰƖ

Try it online!

ą                 implicit input; convert to ąrray of characters
 2Ĩ               due to oversight in implementing arbitrary-base integer
                  Ĩnterpretation, this returns the position for each character
                  in the list of potential base characters (which is a contiguous
                  stretch)
   4+             add 4 to each
     1ᴇ%          modulo 10
        ǰ         ǰoin without delimiters
         Ɩ        cast to Ɩnteger; implicit print

Fig, \$9\log_{256}(96)\approx\$ 7.408 bytes

_O%12%92C

Try it online!

_O%12%92C 
        C # Convert to charcodes
     %92  # Mod 92
  %12     # Mod 12
 O        # Join the list of digits
_         # Cast to number to get rid of leading 0s

Nibbles, 6.5 6 bytes (12 nibbles)

`@~.$`&%$12

A port of Lynn's Jelly answer comes out half-a-byte a byte shorter in Nibbles.

   .            # Map over 
    $           # the input string:
     `&         #  bitwise-and of
        $       #  each element
       %        #  modulo
         12     #  twelve
                #  and itself
`@~             # Finally, convert from base-10 digits

enter image description here

Vyxal, 7 bytes

C:12%⋏ṅ

Try it Online!

Port of Lynn's answer thanks to steffan.

Prolog (SWI), 40 bytes

A+O:-unicode_nfkd(A,C),atom_number(C,O).

Try it online!

Builtins

Excel, 72 63 bytes

Saved 9 bytes thanks to JvdV

=--CONCAT(MOD(MOD(UNICODE(MID(A1,SEQUENCE(LEN(A1)),1)),92),12))

Not very exciting, really. It's the Excel version of Arnauld's answer.

Raku, 14 10 11 8 bytes

+1 and +4 to remove leading 0's.

-3 bytes thanks to Moonchild!

+~*.NFKD

Try it online!


Raku -p, 15 19 bytes

-1 byte and -1 flag thanks to Jo King!

$_=+S:g{.}=$/.EVAL

Try it online!

Raku uses superscript digits as exponents, but single digits on their own evaluate to their numeric value.

Lua, 94 bytes

r=0 t={[185]=1,[178]=2,[179]=3}for _,c in utf8.codes(...)do r=r*10+(t[c]or c-8304)end print(r)

Try it online!

APOL, 46 27 bytes

I(j(ƒ(i %(%(↶(∋) 92) 12))))

Uses Arnauld's 92/12 solution.

Note: 3 bytes can be saved by removing the I instruction, however this version is not case 5-compliant.

Explanation

I(               Cast to integer
  j(             Join string (default is no seperator)
    ƒ(           List-builder for loop (returns a list of every returned value of the passed instruction)
      i          Get input
      %(         Modulo 2 (12)
        %(       Modulo 1 (92)
          ↶(     Get codepoint
            ∋    The current item in the for loop
          )
        92
        )
      12
      )
    )
  )
)
Implicit print

Old code (uses lookup table instead):

v(0 []);f(i a(0 t(⌕("⁰¹²³⁴⁵⁶⁷⁸⁹" ∋))));I(j(⁰))

Python 3.8 (pre-release), 46 50 bytes

-1 thanks to ovs!

lambda x:int(x.translate('%7d   45678923'%10*999))

Try it online!

Helper program to generate this: helper

Hexagony, side length 4, 37 bytes

92},/%=\_@=..}{<.{\<.>".2//{%.1!}>'/_

Unwrapped code:

    9 2 } ,
   / % = \ _
  @ = . . } {
 < . { \ < . >
  " . 2 / / {
   % . 1 ! }
    > ' / _

Try it on hexagony.net

This is my first post on Code Golf, and first time using Hexagony. It's as painful as the name implies, but so satisfying to get a result! I ended up with more mirrors than I expected, but I'm pretty proud of what I achieved.

Credit to the previous users who worked out the modulo trick. My hexagon would have been a lot bigger without %92%12!

Python 3, 89 bytes

lambda a:int(a.translate(dict(zip(map(ord,"⁰¹²³⁴⁵⁶⁷⁸⁹"),"0123456789"))))

Try it online!

-77 Bytes thanks to @grandBagel

-31 Bytes thanks to @ovs

JavaScript, 65 62 61 60 bytes

s=>s.replace(/./g,x=>-~'¹²³⁴⁵⁶⁷⁸⁹'.search(x))

Saved 3 bytes thanks to Neil.

Saved 1 byte thanks to Shaggy.

Saved 1 byte thanks to Arnauld.

Try it online!

Factor, 13 bytes

[ nfkd dec> ]

nfkd postdates the build TIO uses, so have a screenshot:

enter image description here

Ruby, 40 bytes

->s{s.tr("⁰-⁹¹²³","0-9123").to_i}

Try it online!

R, 45 53 51 bytes

Edit +8 bytes to comply with the updated rules (0123 -> 123), but then -2 bytes thanks to pajonk

function(s)el(chartr("⁰¹²³⁴-⁹","0-9",s):1)

Try it online!


R, 53 51 57 bytes / 25 bytes with IO as character codes

Edit: -4 bytes thanks to pajonk, but then +6 bytes (again thanks to pajonk) to comply with the updated rules

function(s,x=utf8ToInt(s))el(intToUtf8(x%%64-8*!x-185):1)

Try it online!

Function without multi-byte character codes, but sadly the verbose utf8ToInt and intToUtf8 function names make it quite long if we want to accept input directly as a string...

The new rule that ⁰¹²³ should output 123 invalidates the second version with IO as character codes. It could be fixed for +17 bytes, but it's shorter to completely change approach (below), porting Arnauld's charcode-to-digit method.


R, 40 bytes with IO as character codes

function(c)c%%92%%12%*%10^rev(seq(!c)-1)

Try it online!

Turing Machine Code, 99 bytes

* ⁰ 0 r *
* ¹ 1 r *
* ² 2 r *
* ³ 3 r *
* ⁴ 4 r *
* ⁵ 5 r *
* ⁶ 6 r *
* ⁷ 7 r *
* ⁸ 8 r *
* ⁹ 9 r *

Try it online!

Nim, 63 bytes

import strutils,unidecode
stdin.readAll.unidecode.parseInt.echo

Try it online!

If removing leading zeros is not required:

Nim, 45 bytes

import unidecode
stdin.readAll.unidecode.echo

Try it online!

APL (dzaima/APL), 16 15 bytes

−1 byte thanks to rak1509

Anonymous tacit prefix function. Requires 0-based indexing.

10⊥'⁰¹²³⁴⁵⁶⁷⁸'⍳

Try it online!

10⊥ evaluate in base 10

'⁰¹²³⁴⁵⁶⁷⁸'⍳ the respective indices of the argument characters in this string (any character not in the string gets the first index beyond the end, i.e. 9)

PHP, 35 bytes

<?=+iconv('','US//TRANSLIT',$argn);

Try it online!

Some nice PHP builtin

C (gcc) with -funsigned-char, 63 bytes

This version takes a string of UTF-8 characters. If the leading byte is E2 then I mask the third byte with 15; otherwise I mask the second byte with 3. It's useful that B9 (the trailing byte of ¹) is odd!

i;f(char*s){for(i=0;*s;s++)i=(*s++-226?*s&3:*++s&15)+i*10;i=i;}

Try it online!

Husk, 10 9 bytes

dm(Sn%12c

Try it online!

Port of Arnauld's Javascript answer Lynn's Jelly answer.

The 'charcode-to-charcode' modulo-except-when-it's-185 approach is discouragingly long in Husk, but Lynn's 'charcode-to-digit' modulo-AND approach is very well-suited to Husk's d (digits to decimal number) function.

05AB1E, 11 8 bytes

Ç92%12%J

-3 bytes porting @Arnauld's JavaScript method (thanks @Neil for the heads up).

Add a trailing ï (+1 byte) if you want to remove leading 0s..

Try it online or verify all test cases.

Explanation:

Ç         # Convert the (implicit) input to a list of its codepoint-integers
          #  e.g. "⁰¹²³⁴⁵⁶⁷⁸⁹" → [8304,185,178,179,8308,8309,8310,8311,8312,8313]
 92%      # Modulo-92
          #  → [24,1,86,87,28,29,30,31,32,33]
    12%   # Modulo-12
          #  → [0,1,2,3,4,5,6,7,8,9]
       J  # Join the list together
          #  → 0123456789
        ï # (Optionally) Remove leading 0s by casting to an integer
          #  → 123456789
          # (after which the result is output implicitly)

JavaScript (ES6), 43 bytes

Edit: +1 to support 0123 -> 123 ...

s=>+s.replace(/./g,c=>c.charCodeAt()%92%12)

Try it online!

Conversion table

 char. | code | mod 92 | mod 12
-------+------+--------+--------
  '⁰'  | 8304 |   24   |   0
  '¹'  |  185 |    1   |   1
  '²'  |  178 |   86   |   2
  '³'  |  179 |   87   |   3
  '⁴'  | 8308 |   28   |   4
  '⁵'  | 8309 |   29   |   5
  '⁶'  | 8310 |   30   |   6
  '⁷'  | 8311 |   31   |   7
  '⁸'  | 8312 |   32   |   8
  '⁹'  | 8313 |   33   |   9

Jelly, 7 bytes

O%12&ƊḌ

Try it online!

O         Get ordinal values
 %12&Ɗ    Apply x ↦ x%12&x
      Ḍ   Digits to number

I found the x%12&x formula by computer search. If I/O were super duper lenient, I guess %12& would be a valid 4-byte answer.

Haskell, 75 bytes

f=mapM(\x->[putStr$show k|k<-[0..],x=="⁰¹²³⁴⁵⁶⁷⁸⁹"!!k]!!0)

Try it online!

Japt -m, 7 bytes

Use Arnauld's formula so be sure to upvote him.

c %#\%C

Try it

C (gcc), 83 \$\cdots\$ 60 46 bytes

n;f(int*s){for(n=0;*s;)n+=9*n+*s++%92%12;n=n;}

Try it online!

Inputs a pointer to a wchar_t string of superscript numbers.
Returns the normal number.

Discovered the n % 92 % 12 formula independently.

Java, 67 bytes

s->java.text.Normalizer.normalize(s,java.text.Normalizer.Form.NFKD)

Try it online!

JavaScript, 20 bytes

s=>s.normalize`NFKD`

Try it online!

Retina 0.8.2, 19 bytes

T`⁰-⁹_¹²³`dd

Try it online! Link includes test cases. Explanation: d is a shorthand for 0123456789. As ⁰-⁹ expands to ⁰ⁱ⁲⁳⁴⁵⁶⁷⁸⁹, and assuming none of ⁱ⁲⁳ will appear in the input, those supserscript digits will get mapped to ASCII digits, while the _¹²³ gets mapped to 0123 (the remaining digits in d get ignored). _ is actually a placeholder on the LHS and does nothing except to skip 0 on the RHS (on the RHS it causes the character on the LHS to be deleted).

Charcoal, 2 bytes

IV

Try it online! Explanation:

 V  Eval as a Charcoal integer literal
I   Cast to string
    Implicitly print

Python 3, 53 bytes

from unicodedata import*
lambda s:normalize("NFKC",s)

Try it online!

Python 3, 63 62 bytes

lambda n: int("".join([str("⁰¹²³⁴⁵⁶⁷⁸⁹".index(c))for c in n]))

Thanks @Fmbalbuena!