FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Su ayuda con este c贸digo
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Su ayuda con este c贸digo
Posted: Fri Mar 11, 2022 11:46 PM
Hola Amigos del foro:

Por favor ay煤denme a entender este simple y sencillo c贸digo

Code (fw): Select all Collapse
   ? "Texto" <> ""
   ? "Texto" == ""


Ambos me devuelven FALSE, y mi l贸gica me dice que la primera comparaci贸n
deber铆a ser TRUE, ser谩 que la noche ha sido larga? :-)

Saludos
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 12:17 AM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 03:12 AM

Crist贸bal:

Perfecto, me estaba volviendo loco :oops: .

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 05:38 AM

Use
? !( "TextTo" == "" )
This does not require changing SET EXACT.
Please note that setting SET EXACT ON will have global effect and somewhere some comparisons may give different results.

Regards



G. N. Rao.

Hyderabad, India
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 07:18 AM

Mr. Rao:

Thanks a lot.

Best regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 09:20 AM
The opposite of

Code (fw): Select all Collapse
? "Texto" <> ""


is

Code (fw): Select all Collapse
? "Texto" = ""


EMG
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 11:16 AM
nageswaragunupudi wrote:Use
? !( "TextTo" == "" )
This does not require changing SET EXACT.
Please note that setting SET EXACT ON will have global effect and somewhere some comparisons may give different results.


Dear Rao
Do you mean that what we have to do is induce our code to obtain the result that we expect and that it is not harbour, using the commands and functions that it provides us, that resolves the expression?
So, let's not put the expression (!) and put directly ( ? .T. ) or ( ? .F. ) depending on the result you want to obtain, right? It would be much simpler ( it's a joke ).
The colleague's question is why he obtains that result when the expression is evaluated, I don't think he should be induced as to how it would be resolved to obtain the expected result, that should be done by Harbour.
Use SET EXACT ON and SET EXACT OFF when needed, that's my advice

Quiere decir usted que lo que hay que hacer es inducir a nuestro codigo a obtener el resultado que nosotros esperamos y que no sea harbour, usando los comandos y funciones que nos proporciona, el que resuelva la expresi贸n?
Entonces, no pongamos la expresion (!) y ponga directamente ( ? .T. ) o ( ? .F. ) dependiendo del resultado que usted desea obtener, no?, ser铆a mucho m谩s sencillo ( es una broma ).
La pregunta del compa帽ero es por qu茅 obtiene ese resultado al ser evaluada la expresi贸n, no creo que se le deba inducir a como se resolver铆a para obtener el resultado esperado, eso debe hacerlo Harbour.
Use SET EXACT ON y SET EXACT OFF cuando se necesite, ese es mi consejo


Armando, por favor, prueba este codigo ( sin el SET EXACT ON )
Code (fw): Select all Collapse
? "" <> "Text"
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 03:41 PM

Crist贸bal:

? "" <> "Text"

Funciona como se espera, retorna (.T.)

Pero
? "Texto" <> ""
No funciona como se espera, retorna (.F.)

Me estoy volviendo loco

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 03:55 PM
As I wrote, "Text" <> "" is the opposite of "Text" = "", so

Code (fw): Select all Collapse
? "Text" <> ""


gives .F. because it is the opposite of

Code (fw): Select all Collapse
"Text" = ""


that gives .T. because "Text" begins with "" (any strings contain or begins with ""). Moreover

Code (fw): Select all Collapse
"" <> "Text"


gives .T. because it is the opposite of

Code (fw): Select all Collapse
"" = "Text"


that gives .F. because "" (the empty string) doesn't begin with "Text".

EMG
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Su ayuda con este c贸digo
Posted: Sat Mar 12, 2022 10:01 PM

Enrico, I totally agree with you.

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion