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


Groups > comp.lang.forth > #59525

Re: Rosetta: Increment a numerical string

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From rickman <gnuarm@gmail.com>
Newsgroups comp.lang.forth
Subject Re: Rosetta: Increment a numerical string
Date Fri, 19 May 2017 00:16:00 -0400
Organization A noiseless patient Spider
Lines 22
Message-ID <oflrbl$8ob$3@dont-email.me> (permalink)
References <oflpmm$13v1$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 19 May 2017 04:12:37 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="62f3bdc9f9e5697eb6084fa6b2136468"; logging-data="8971"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18SkSD3CDjvJ5dPH8b0a92a"
User-Agent Mozilla/5.0 (Windows NT 6.2; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
In-Reply-To <oflpmm$13v1$1@gioia.aioe.org>
Cancel-Lock sha1:AlXca6q6jzFbT89ELC6+wAJpKoE=
Xref csiph.com comp.lang.forth:59525

Show key headers only | 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