Jump to content

This seem like a fun new language !


Recommended Posts

Posted

image.png.b0c12081dee2c3c6e8ba34f5c0ba79c6.png

  • Like 1
  • Haha 4
Posted

I wouldn't be too harsh on them, for I've made that kind of mistake a few times when my mind is on autopilot. It might well be that articles are built using a form and template that simply adds -th to whatever number must go on that position. At least it's not French and its quatre-vingt dix-neuf (lit. "four-twenty ten-nine") for 99, or saying "veinticatorce" (lit. "twenty-fourteen") to mock seemingly impossible numbers in Spanish (although it technically works when considered as a hexadecimal: 2E16=4610, since E equals fourteen). Still, a function that determines the proper ending for a numeric ordinal shouldn't be that hard to code.

Salute.

  • Like 6
Posted

There is something called 'proof reading' which, these days, appears to be a weakening skill 😒 (even in books). 

  • Like 4
Posted

I've decided to take the challenge, dust off my knowledge in JavaScript and create the function. It'll need further refining (a check to ensure the proper data type for the input, for example), but the basic structure is this, comments included:

Quote

function ordinalEnding(inNumber){
    var outOrdinal;
/* Input number divided by 10, floored to get the quotient, then
modulo so it works no matter how many digits there are in it. */
    var tensNumber = Math.floor(inNumber / 10) % 10;
/* One unit substracted from the input number to align with
computer ordinality (i.e. 0 is the first, 1 is the second...),
then modulo. */
    var unitsNumber = (inNumber - 1) % 10;
/* Checking both tens and units. If tens are equal to 1, the
first if is bypassed, that way 11th, 12th and 13th are properly
created and displayed. Same for units not being 1, 2 or 3. */
    if (tensNumber != 1 && unitsNumber < 3){
        if (unitsNumber == 2){
            outOrdinal = inNumber + "rd";
        } else if (unitsNumber == 1){
            outOrdinal = inNumber + "nd";
        } else {outOrdinal = inNumber + "st"}
    } else {outOrdinal = inNumber + "th"}

    return outOrdinal;
}

I'm adding it to my "no externally controlled (looking at you, Google) code allowed" collection.

6 hours ago, Aethervox said:

There is something called 'proof reading' which, these days, appears to be a weakening skill 😒 (even in books). 

It's been like that for over two decades, at least in Spain. Local newspapers either fired their proofreaders or waited until their retirement and didn't hire new ones, then the same started happening at the national level. They now trust whatever comes from the news agencies. Book publishers certainly aren't any better: a teacher I met long ago told me of one year when he and his students found so many mistakes (in the textbook they were supposed to follow, no less) that, instead of contacting the publisher each time they spotted one, they decided to compile and send them all in one letter.

Salute.

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.