[x]

deviantART

 

Creative Commons License
Some rights reserved. This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
Details
Submitted: September 12, 2007
File Size: 58.7 KB
Image Size: 58.7 KB
Resolution: 1208×802
Comments: 8
Favourites & Collections: 0

Views
Total: 322
Today: 0

Downloads
Total: 9
Today: 0

Thumb

Artist's Comments

This function is something I needed as I required a way to convert a time-span, in seconds, into a representative string. I also wanted something that produced a gramatically correct string. This was not going to be the easiest function to make, but I cracked at it and came out with this result, and works fine with positive values. The edit I have on my computer can handle negative values.

Sorting out the different numeric values to be used in the string was easy enough, but figuring out the code to sort the numbers into a grammatically accurate string was difficult. I wanted the function to be short and tidy, so I decided to use the ternary operator, and as a result created some amazingly long lines.

The section of code which works out the string is by far the longest part of the function, and the was the most difficult to create. It was tested and edited many times, to make sure that absolutely every possible variation worked! Thankfully, it works, and I made it into a generic function so that it can be used anywhere.

Thanks for reading.
[x]

Devious Comments

love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0

Comments


uhm, adorable and lovely! (i don't get it, but anyway, i love small ants in your work)
:blowkiss: =D

--
:gallery: antimatter..
hey, nothing lasts forever!
ants? Where? lol

--
I kick, therefore I > #IdleRPG.

I am a founder of ~dAGamers. Have a look and join if you are a gamer!
lol, everywhere-> , . etc

--
:gallery: antimatter..
hey, nothing lasts forever!
commas and full-stops?

--
I kick, therefore I > #IdleRPG.

I am a founder of ~dAGamers. Have a look and join if you are a gamer!
yea ;) you're the man!

--
:gallery: antimatter..
hey, nothing lasts forever!
You rule. :O

--
I believe in Jesus Christ as my Savior. If you do too and aren't scared to admit it then copy and paste this in your signature.
There are far better examples of code than the one shown here =p

--
I kick, therefore I > #IdleRPG.

I am a founder of ~dAGamers. Have a look and join if you are a gamer!
I know XD

--
I believe in Jesus Christ as my Savior. If you do too and aren't scared to admit it then copy and paste this in your signature.

Site Map