Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #59525

Re: Rosetta: Increment a numerical string

From rickman <gnuarm@gmail.com>
Newsgroups comp.lang.forth
Subject Re: Rosetta: Increment a numerical string
Date 2017-05-19 00:16 -0400
Organization A noiseless patient Spider
Message-ID <oflrbl$8ob$3@dont-email.me> (permalink)
References <oflpmm$13v1$1@gioia.aioe.org>

Show all headers | View raw


On 5/18/2017 11:44 PM, Robert L. wrote:
> "foo99bar".sub(/\d+/){|s| s.to_i + 1}
>     ==>"foo100bar"
>
> "foo99bar".sub(/\d+/){|s| 2**s.to_i }
>     ==>"foo633825300114114700748351602688bar"
>
> In Forth?

If this is doing what I think it is doing, I wrote that in an Excel 
formula... lol

=CONCATENATE(LEFT(M84,7),TEXT(1+NUMBERVALUE(MID(M84,8,3)),"000"),"A")

Turns "16N048-033A" into "16N048-034A"


Silly rabbit!

-- 

Rick C

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Rosetta: Increment a numerical string "Robert L." <No_spamming@noWhere_7073.org> - 2017-05-19 03:44 +0000
  Re: Rosetta: Increment a numerical string rickman <gnuarm@gmail.com> - 2017-05-19 00:16 -0400
    Re: Rosetta: Increment a numerical string Julian Fondren <julian.fondren@gmail.com> - 2017-05-18 21:47 -0700
      Re: Rosetta: Increment a numerical string rickman <gnuarm@gmail.com> - 2017-05-19 01:24 -0400

csiph-web