Sintaxis
AT_C(cExpresiónBúsqueda, cExpresiónBuscada [, nAparición])
SAludos!!
The simple functions At() returns the position of one string within another. This example will return 5 because "E" first occurs as the 5th character of "ABCDEFGHABCDEFGH":
If the target can't be found in the string then At() will return 0. The search is case-sensitive. Use the FoxPro AtC() function for a case-insensitive search.
The Rat() function will search backwards from the end of the string. This example will return 13 because "E" last occurs as the 13th character of "ABCDEFGHABCDEFGH":
Both the At() and Rat() functions can take a third numeric parameter to specify whether FoxPro should report the first, second or nth instance of the character. This example will return 13 because it is looking for the second occurence of the target and "E" makes its second appearance as the 13th character of "ABCDEFGHABCDEFGH":
The FoxPro Occurs() function counts the number of times that a character occurs in another string.
Saludos a todos!!
Jeanette
cCadena = "1364,11,01,30,09,24,59,02,20,C,001870,005000,3740,01,03,03,02,147,,OK# ,"
nVeces = OCCURS(",", cCadena)
FOR i = 0 TO nVeces
?SUBSTR(cCadena, IIF( i =0, 1, AT(",", cCadena, i)+1 ), ;
(IIF( i =0, AT(",", cCadena) , AT( ",", cCadena, i+1)) - ;
IIF( i =0, 0, AT(",", cCadena, i)) ) -1 )
ENDFOR
Recuerda siempre adicionarle una coma al final de la cadena..
MK
-----Mensaje original-----
De: publice...@googlegroups.com [mailto:publice...@googlegroups.com] En nombre de Jhonny Zambrana
Enviado el: viernes, 04 de febrero de 2011 10:48 a.m.
Para: Comunidad de Visual Foxpro en Español
Asunto: [vfp] conocer posicion de un caracter dentro una cadena...
Tengo uno mas sencillo
CLEAR
cCadena = "1364,11,01,30,09,24,59,02,20,C,001870,005000,3740,01,03,03,02,147,,OK# ,"
nVeces = OCCURS(",", cCadena)
FOR i = 0 TO nVeces
?SUBSTR(cCadena, IIF( i =0, 1, AT(",", cCadena, i)+1 ), ;
(IIF( i =0, AT(",", cCadena) , AT( ",", cCadena, i+1)) - ;
IIF( i =0, 0, AT(",", cCadena, i)) ) -1 )
ENDFOR
Ponerle siempre una coma o variable por la cual se le hace la separación.
Echa al vuelo ..
MK
cCadena = "1364,11,01,30,09,24,59,02,20,C,001870,005000,3740,01,03,03,02,147,,OK#
,"
*
a=GETWORDCOUNT(cCadena,',')
*
FOR x=1 TO a
?GETWORDNUM(cCadena,x,',')
ENDFOR
Un saludo.
El día 4 de febrero de 2011 17:37, Miguel Canchas
<mcan...@ximesa.com> escribió:
--
Jose A. Blasco
Zaragoza - España
Luis María Guayán
Tucumán, Argentina
_________________________
http://www.PortalFox.com
Nada corre como un zorro
_________________________
;-)
Un saludo.
El día 4 de febrero de 2011 18:46, Luis Maria Guayan
<luis...@portalfox.com> escribió:
--
ATC(",",<cadena>,1) && devuelve la posición de la primera coma.Saludos,
Alfonso