On Mon, Jan 31, 2011 at 8:03 PM, Ian Clark <[email protected]> wrote:
> What's people's fave way to generate the next (or previous) id in a
> series, eg 'abc00100' from the string 'abc00099'?

I never use this but if I did, I probably would use:

incsfx=: (,  >:&.".&.(,~&'1')@,&'x')&>/@(</.~  <./\.@e.&'0123456789')

Note, however, that I did not limit the suffix length to 8 digits,
instead I wrap when however many digits were in use becomes
inadequate.

Note also that this requires that a non-numeric prefix be present.
If that were a problem you could use incsfx&.(,~&' ')

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to