123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|230|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> On Topic -> Currency Conversion !?!?!

Fri, 19 Dec 2008, 10:07
Jayenkai

Fri, 19 Dec 2008, 12:35
Phoenix
It won't be possible to have something like [curr]$100[/curr] since that could be canadian, american, australian (etc) dollars. It would have to be [curr=USD]100[/curr], and then you have another table containing the currency prefixes and have them added before the number.

I don't really see what the problem is though. Where do you need the regex?
Fri, 19 Dec 2008, 13:48
Stealth
Here is a function I wrote based off of Phoenix's code.

It uses Google, but I wrote a fail safe in to it *just* in case it breaks someday. Just remember to replace "somebody@example.com" with a real email address.




-=-=-
Quit posting and try Google.
Fri, 19 Dec 2008, 14:53
Jayenkai
I know that [curr]$ won't always work, but 99% of the time it will! I would, obviously, be adding USD as well.. Look at the big array, it has them all there!!
I was trying to get the simplest form of written currency.. hence why I wrote "Lets take it to it's most basic.."

Blinkin' munky's, it's like nobody read what I put there!


Having a good think about it at work, I figured I'll do it without regex, and just flick through the possibilities manually.. Probably the best bet.
Going to have to do it between where it pulls out the code box stuff, though, 'cos otherwise it'll be plucking all your variables up as money!!

-=-=-
''Load, Next List!''
Fri, 19 Dec 2008, 15:34
Phoenix
it's like nobody read what I put there!


I've read it ten times and I still don't get it
Sun, 21 Dec 2008, 12:06
Evil Roy Ferguso
This accepts things in the form [ curr ]currencyamount[ /curr ]. It may not be the fastest way of doing things, but it's pretty short and readable.

|edit| Ack, just noticed the conversions were being done backwards. Should be fine now.

|edit| New version further down!
Sun, 21 Dec 2008, 14:46
Jayenkai
Ta, I haven't had a chance to play with it, yet though.. Busy busy week of Xmas! Bah, humbug!!

-=-=-
''Load, Next List!''
Tue, 13 Jan 2009, 22:27
Evil Roy Ferguso

Wed, 14 Jan 2009, 00:18
Jayenkai
Thanks.
And, although I'm sure that's easy to implement, I'm not in any kind of Socoder-script-tweak position right now!
Knowing me, If I download the file over PHP, tweak it, then upload it again, I'd probably forget I ever did it.. And then once all my old files are up and running again, I'd end up with 2 versions of Socoder, and inevitably overwrite all the new work I'd done!

It'll have to wait, I'm afraid..

-=-=-
''Load, Next List!''
Wed, 14 Jan 2009, 07:54
Evil Roy Ferguso
Oh, that's not a problem. I revised my code because I have obsessive-compulsive disorder and noticed a major inefficiency in my old solution; there's no hurry to add the code, and even then, I honestly don't mind if it's never used -- it's just that having the old version posted was bothering me!

To be perfectly honest, I think that having the currencypop is probably more trouble than it's worth, since Google happens to exist.