djgraham asks:

any way of easily extracting the numerical part of a string+integer  
(i'm wanting to find out the next number ina series.. e.g..   
"INV1001".next etc.  but "INV9999".next changes it to "INW0000"

There were a bunch of suggestions including for a joke:

"INV#{'INV000'.reverse.to_i.to_s.reverse.next}"
Turns out that that is faster than all the options that use regexes:
http://pastie.textmate.org/private/6xcy4fgodvs5zsjrhcaq
Anyway, I figured i'd throw this out to the list for a bit of fun. The  
idea is to correctly create a string containing the next in the  
sequence, so "INV0123" becomes "INV124", but in the craziest way  
possible. Use of pack or c extensions a bonus.

Will.

-- 
Will Jessop
Super Shiny Robot Limited - Professional web design and development

t: 07939 547 962
w: http://supershinyrobot.com/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nwrug-members?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to