PDA

Ver la Versión Completa : función POS


petete2008
05-09-2012, 12:18:41
Lcategorias:='5#1408#';
cadena:='1408#';

if (Pos(Lcategorias,cadena)>0) then
showmessage('encontrado')
else
showmessage('no encontrado');


¿porque dá 'no encontrado' cuando debería ser 'encontrado'?
Gracias.

WkaymQ48
05-09-2012, 12:48:47
Prueba así:

if (Pos(cadena,Lcategorias)>0) then

Casimiro Notevi
05-09-2012, 12:51:31
...
Recuerda poner títulos descriptivos a tus preguntas, gracias :)

juanlaplata
05-09-2012, 16:21:46
Tal como dice WkaymQ48 , la fuente en F1.

function Pos(Substr: string; S: string): Integer;

Description

Pos searches for a substring, Substr, in a string, S. Substr and S are string-type expressions.

Pos searches for Substr within S and returns an integer value that is the index of the first character of Substr within S. Pos is case-sensitive. If Substr is not found, Pos returns zero.

petete2008
05-09-2012, 16:30:27
Prueba así:
Código Delphi [-] (http://www.clubdelphi.com/foros/#)if (Pos(cadena,Lcategorias)>0) then




Gracias, solucionado!!
Se me ha ido la "pinza" totalmente y lo había puesto al reves, jajaja.