I wrote a parser for my template files to convert lower case to upper case characters in comments. It can be adapted to remove or replace other undesirable characters as well.
Note: In the following example I set the maximum string length at 24. This is to control the looping in the #REPEAT command. The ideal situation would be to use the STRLEN() function to set this according to the length of the string to be parsed. While the STRLEN() function works fine in the macro environment, it has some glitches in the template environment. STRLEN() does not count spaces, will skip them and give you a short string length. STRLEN() does not allow for commas, will return a 0 string length. Because of these limitations it was more practical to define a maximum length. There are no errors if the string is shorter than the max. // #S0 original source string // #S1 single character to be parsed from source string // #S2 parsed result string // #U0 maximum string length // #U1 current character number in string // set source string value for testing #EVAL(#S0=dis, "codice=d3048") // loop through all characters in string and make substitutions // set maximum string length #EVAL(#U0=STRLEN(#S0)) #EVAL(#U0=24) // blank result string #EVAL(#S2=) // set counter for first character in string #EVAL(#U1=1) #REPEAT(#U0)< #EVAL(#S1=STRSUB(#S0,#U1,1)) // subtitute space with underscore character #IFSTR(#S1= )<#EVAL(#S1=_)> // subtitute lower case with upper case characters #IFSTR(#S1=a)<#EVAL(#S1=A)> #IFSTR(#S1=b)<#EVAL(#S1=B)> #IFSTR(#S1=c)<#EVAL(#S1=C)> #IFSTR(#S1=d)<#EVAL(#S1=D)> #IFSTR(#S1=e)<#EVAL(#S1=E)> #IFSTR(#S1=f)<#EVAL(#S1=F)> #IFSTR(#S1=g)<#EVAL(#S1=G)> #IFSTR(#S1=h)<#EVAL(#S1=H)> #IFSTR(#S1=i)<#EVAL(#S1=I)> #IFSTR(#S1=j)<#EVAL(#S1=J)> #IFSTR(#S1=k)<#EVAL(#S1=K)> #IFSTR(#S1=l)<#EVAL(#S1=L)> #IFSTR(#S1=m)<#EVAL(#S1=M)> #IFSTR(#S1=n)<#EVAL(#S1=N)> #IFSTR(#S1=o)<#EVAL(#S1=O)> #IFSTR(#S1=p)<#EVAL(#S1=P)> #IFSTR(#S1=q)<#EVAL(#S1=Q)> #IFSTR(#S1=r)<#EVAL(#S1=R)> #IFSTR(#S1=s)<#EVAL(#S1=S)> #IFSTR(#S1=t)<#EVAL(#S1=T)> #IFSTR(#S1=u)<#EVAL(#S1=U)> #IFSTR(#S1=v)<#EVAL(#S1=V)> #IFSTR(#S1=w)<#EVAL(#S1=W)> #IFSTR(#S1=x)<#EVAL(#S1=X)> #IFSTR(#S1=y)<#EVAL(#S1=Y)> #IFSTR(#S1=z)<#EVAL(#S1=Z)> // increment counter for next character in string #EVAL(#U1=#U1+1) // build parsed string #EVAL(#S2=#S2#S1) > // output parsed string to code file (#S2) ================================================== Fred Lauzus, CAM Programming Coordinator High Steel Structures, Incorporated mailto:[EMAIL PROTECTED] http://www.highsteel.com ================================================== -----Original Message----- From: Edgar Tejeda [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 28, 2003 5:02 PM To: 'Kevin Clark'; Andrew Eckstrom; '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' Subject: [mfg-smartcam] pOST EDIT METHODS we need to know how to delete the space between (dis, "codice=d3048") this space makes it impossible to download programs from c.m.s. winncom. we would like to delete this from the post processor, we have not been able to find the post in SmartCam v11. please help (DIS, "CODICE=D3048") % T99 M06 G79 G00 Z0 (UAO,1) T0 G70 (UAV,3,V,Y,1,1) G90 G00 X-1.0 Y27.505 (DLY,.2) ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ====================================================================== ====================================================================== To find out more about this mailing list including how to unsubscribe, send the message "info mfg-smartcam" to [EMAIL PROTECTED] ======================================================================
