POV-Ray : Newsgroups : povray.general : An string macro that returns the input inverted. : Re: An string macro that returns the input inverted. Server Time
26 Apr 2024 08:27:25 EDT (-0400)
  Re: An string macro that returns the input inverted.  
From: jr
Date: 17 Jun 2020 17:20:09
Message: <web.5eea875a3fadb0934d00143e0@news.povray.org>
hi,

"B. Gimeno" <nomail@nomail> wrote:
> /* --------------------------------------------------------------------------
> When a S1 string is entered, it returns a S2 string reordered from the end to
> the beginning."
>
> Usage: [limit: up to a 256 character long string]
> Inv_String("gninnigeb eht ot dne eht morf deredroer gnirts 2S a snruter ti,
> deretne si gnirts 1S a nehW")
>
> Disclaimer: Use this code only under your own discernment. The author declines
> all responsibility in the event that tentacular entities of a remote underworld
> possess the user for trying to decipher "modern" music lyrics by reading it
> backwards (or forward).
>
> --------------------------------------------------------------------------- */
> #macro Inv_String (S)
>  #local C = strlen (S) ;
>  #local I_S = concat ( #for(C,C,0) substr(S,C,1); #end )
>  I_S
> #end
> // ---------------------------------------------------------------------------

which version are you using?  tried with alpha.10064268, but got no output.
have to use "concat ( #for(J,C,0,-1) substr(S,J,1) #end )" to get it to work;
with semicolon I get a "Parse Error: Expected 'string expression', ; found".
still, neat!


regards, jr.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.