Ed:
> I posted a REBOL version, but I'm not terribly gifted at writing
> parse rules. I'd be curious to see how other REBOLers might handle it.

Just saw your message this morning -- or some reason it's on the archive but 
didn't make it to my inbox.

It's never clear just how much validation should be involved in an exercise 
like this. Should we be handling invalid cases where the last group does not 
contain a number?

If the answer to that is no, then the code can be very simple - just need to 
find and increment the last string of digits.  In fact, it can be simpler than 
below as my code is not a pre-parse solution. But it works, and that's 
usually as far as I take things.



bump-id: func [id [string!]
  /local
   number
   number-copy
   digit
   digits
][
 digit: charset "0123456789"
 digits: [some digit]
 id: head reverse id
 parse/all find id digit [copy number digits]

 number-copy: 1 + to-integer head reverse copy number
 replace id number head reverse form number-copy
 id: head reverse id
 return id
]



Sunanda.
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to