Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
drRoss48808y@C-Info Ha, i have a script that does exactly that. I'm not even sorry about it either.
-
If you think about it you just have to write 1 or 2 cases, copy them a bunch of times and just change the numbers.
I am guessing you need less than 30 seconds to copy paste and change the numbers.
Probably this is faster than writing some code to do the same. -
@nickpapoutsis as I see it:
String result = "";
if (field starts witg '-') { result += "nein"; trim "-"; }
result += {{number}} + ".png"
As long as the assumption holds this is more extensible.
On the other side the shown solution is safer as someone has validated if the file exists... But, if you enter a new file or want to change a name you have a maintenance problem. -
I would directly work with CSS3 and HTML for display. With Images for every degree I would go nuts...
-
matanl26448y$temp_morgen=$weer['temperature'] . '.png';
if ($weer['temperature'][0]=='-')
$temp_morgen='min' . substr($weer['temperature'],1) . '.png';
Replaced it with 3 short lines why the fu** do that. -
@matanl Made it a one liner for you:
$temp_morgen = ( $weer ["temperature"][0] === "-" ) ? ( "min" . substr( $weer["temperature"], 1 ) . ".png" ) : ( $weer["temperature"] . ".png" );
The person who wrote this deserves an award.
undefined