Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   función POS (https://www.clubdelphi.com/foros/showthread.php?t=80120)

petete2008 05-09-2012 12:18:41

función POS
 
Código:

    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í:
Código Delphi [-]
if (Pos(cadena,Lcategorias)>0) then

Casimiro Notevi 05-09-2012 12:51:31

Cita:

Empezado por petete2008
...

Recuerda poner títulos descriptivos a tus preguntas, gracias :)

juanlaplata 05-09-2012 16:21:46

Tal como dice WkaymQ48 , la fuente en F1.

Cita:

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

Cita:

Empezado por WkaymQ48 (Mensaje 441893)
Prueba así:
Código Delphi [-]if (Pos(cadena,Lcategorias)>0) then


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


La franja horaria es GMT +2. Ahora son las 18:32:36.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi