POV-Ray : Newsgroups : povray.newusers : string/character case Server Time
5 Nov 2024 01:20:33 EST (-0500)
  string/character case (Message 1 to 4 of 4)  
From: Rafal 'Raf256' Maj
Subject: string/character case
Date: 8 Oct 2002 17:36:10
Message: <Xns92A1EFDAF2975raf256com@204.213.191.226>
Hellow, I have a string and I want to make case depending on it's first 
character, like :

   #switch (substr(myString,1,1)) str
     #case ("s","S") #local ret=vStart; #break
     #case ("e","E") #local ret=vEnd; #break
     #case ("c","C") #local ret=vEnd; #break
     #else #error "[!] Unknown logo fade type\n\n"
   #end

how can I do this ?

-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Warp
Subject: Re: string/character case
Date: 8 Oct 2002 21:46:26
Message: <3da38a72@news.povray.org>
Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
> Hellow, I have a string and I want to make case depending on it's first 
> character, like :

>    #switch (substr(myString,1,1)) str
>      #case ("s","S") #local ret=vStart; #break
>      #case ("e","E") #local ret=vEnd; #break
>      #case ("c","C") #local ret=vEnd; #break
>      #else #error "[!] Unknown logo fade type\n\n"
>    #end

> how can I do this ?

  You'll have to do it this way:

   #switch (asc(myString))
     #case (asc("s"))
     #case (asc("S")) #local ret=vStart; #break
     #case (asc("e"))
     #case (asc("E")) #local ret=vEnd; #break
     #case (asc("c"))
     #case (asc("C")) #local ret=vEnd; #break
     #else #error "[!] Unknown logo fade type\n\n"
   #end


-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: ingo
Subject: Re: string/character case
Date: 9 Oct 2002 03:28:25
Message: <Xns92A26124FD667seed7@povray.org>
in news:3da38a72@news.povray.org Warp wrote:

>    #switch (asc(myString))
>      #case (asc("s"))
>      #case (asc("S")) #local ret=vStart; #break
>      #case (asc("e"))
>      #case (asc("E")) #local ret=vEnd; #break
>      #case (asc("c"))
>      #case (asc("C")) #local ret=vEnd; #break
>      #else #error "[!] Unknown logo fade type\n\n"
>    #end
> 

or

 #switch (asc(strupr(myString)))
   #case (asc("S")) #local ret=vStart; #break
   #case (asc("E")) #local ret=vEnd; #break
   #case (asc("C")) #local ret=vEnd; #break
   #else #error "[!] Unknown logo fade type\n\n"
 #end


Ingo


Post a reply to this message

From: Warp
Subject: Re: string/character case
Date: 9 Oct 2002 09:38:19
Message: <3da4314a@news.povray.org>
ingo <ing### [at] tagpovrayorg> wrote:
>  #switch (asc(strupr(myString)))
>    #case (asc("S")) #local ret=vStart; #break
>    #case (asc("E")) #local ret=vEnd; #break
>    #case (asc("C")) #local ret=vEnd; #break
>    #else #error "[!] Unknown logo fade type\n\n"
>  #end

  Of course... How I didn't think of that?

  On the other hand, it might have been good to show how multiple cases
executing the same code are used in a #switch structure, as it may not be
very well known.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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