Eric,

Thanks! I was lookinng for a better way to do this. I'm sort of used to
having the function built into the language, and being a stranger to
Javascript I have to trace down every function call I see in TW or look it
up on the web to determine whether it's built-in or declared locally. At
first glance I assumed that "zeroPad" was part of the language, just as I
did with "formaString".

PL/SQL is basically Ada in syntax with SQL built in, much more verbose and
narrative-like (which was, of course, a goal of SQL way back when), and I
know that shows in my code. Once I fully "internalize" this it will probably
help me refactor the other string handling going on as well.


On Wed, May 20, 2009 at 11:18 PM, Eric Shulman <elsdes...@gmail.com> wrote:

>
> > Not near ready for prime time, though- it's bare-bones function, poor
> > formatting, few comments, no docs, meets no standards yet, and there
> > are some sections I want to refactor.
>
> Try this alternative bit of code for formatting a decimal # with zero-
> padding... it generates the same '000.00' format as your code, but
> doesn't involve any while() loops:
> ------------------------
> function formatBeats(b) {
>        var out='000'+b.toString()+(b==Math.floor(b)?'.':'')+'000';
>        return out.substr(out.indexOf('.')-3,6);
> };
> ------------------------
>
> enjoy,
> -e
> >
>


-- 

Robert T. West ("Tim")
www.roberttwest.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to TiddlyWiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to