te convendr�a echar un vistazo a un manual de rexx
 
ah� va un ejemplo:
 
 /* Programa REXX */                                                 
 /*          <----- source -------->      <--template---->  */       
 parse value 'miguel peinador conde' with nombre ape1 ape2           
                                                                     
 say nombre                                                          
 say ape1                                                            
 say ape2                                                            
                                                                     
 parse value 'miguel angel peinador conde' with nombre ape1 ape2     
                                                                     
 say nombre                                                          
 say ape1                                                            
 say "como tiene mas aqui mete el resto...."                         
 say ape2                                                            
                                                                     
 /* poniendo puntos se salta palabras */                             
 parse value 'miguel angel peinador conde' with . nom2  rest         
 say nom2  /* nom2 vale angel */                                     
                                                                     
 /* puede haber templates mas complejos, separados por comas. P.E. */
 parse value 'miguel angel, peinador conde' with nom "," rest     
 say nom  /* nom vale miguel angel */                             
                                                                  
 /* ...puede haber templates posicionales */                      
 /*          '012345678901234567890123456789' */                  
 parse value 'xxxxxxxxxxccccccccccvvvvvvvvvv' with xx 11 cc 21 vv 
 say xx                                                           
 say cc                                                           
 say vv                                                           
                                                                  
 /* ...puede haber templates o relativos  */                      
 /*          '012345678901234567890123456789' */                  
 parse value '333wwwxxxxxxxxxxxxxxxxxxxxxxxx' with xx +3 cc +3 rest
 say xx                                                           
 say cc                                                           
 say vv                                                           
 
----- Original Message -----
Sent: Thursday, November 11, 2004 1:34 PM
Subject: Parsear un texto ...

buenos dias, hago la siguiente consulta por si alguien tiene algun pedazo de codigo que pueda "regalarme".
 
voy a tener un string que va a contener algo parecido a esto:
"( &F01 * 10 ) +  &F02 * 20 + ( &F03 * 30 )"
 
de eso voy a necesitar reemplazar los &Fxx por sus valores, pero ademas para validar la sentencia voy a necesitar parsear el texto.
Alguien tiene alguna rutina , o ejemplo de como poder hacer esto ??
 
Desde ya muchas gracias
Saludos
 
 
 
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004

Responder a