Why doesn't the program show "yes"

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

Post Reply
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Why doesn't the program show "yes"

Post by huiyi_ch »

Hello friends
Today, when I was debugging a program, I found a strange phenomenon. The program should display "yes", that is, "no". I don't know why? This problem also exists in pb12.

Code: Select all

#include <hmg.ch>
PROCEDURE Main()
local   ddd
ddd="±"+"13213213132"

if hb_at("±",ddd)>1
         msginfo("Yes","info")
else
         msginfo("No","info")
end if 
return
 
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: Why doesn't the program show "yes"

Post by Carlos Britos »

Hi
I'm sure what you mean when you say
should display "yes", that is, "no"
"±"+"13213213132" ---> ± is in pos 1
hb_at("±",ddd)>1 = .F.

hb_at("±",ddd)>0 = .T.
Regards/Saludos, Carlos (bcd12a)
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: Why doesn't the program show "yes"

Post by SALINETAS24 »

huiyi_ch wrote: Sat Nov 14, 2020 2:14 pm Hello friends
Today, when I was debugging a program, I found a strange phenomenon. The program should display "yes", that is, "no". I don't know why? This problem also exists in pb12.

Code: Select all

#include <hmg.ch>
PROCEDURE Main()
local   ddd
ddd="±"+"13213213132"

if hb_at("±",ddd)>1
         msginfo("Yes","info")
else
         msginfo("No","info")
end if 
return
 
Hola Huiyi_ch.
La función hb_at devuelve la posición que ocupa una subcadena en una cadena.
En tu ejemplo, la subcadena "±" ocupa la posición "=1"..., y NO mayor ">1"
Prueba el siguiente codigo.

Code: Select all

if hb_at("±",ddd) > 0      // Encontrada
         msginfo("Yes","info")
else
         msginfo("No","info")
end if 
Una cervecita fresquita con una saludo virtual.....
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: Why doesn't the program show "yes"

Post by huiyi_ch »

Thank you for your help!
I'm sorry, I made a very stupid mistake!
Post Reply