IF

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

IF

Postby luiscambuston » Thu Mar 12, 2020 7:22 pm

I am running this simple code

cUserName := "Luis"

If cUserName <> ""
? "Not Empty"
Else
? "Empty"
EndIf

The response is "Empty".
I tried everything that I can think.
Driving me crazy...

Thanks
luiscambuston
 
Posts: 22
Joined: Mon Mar 02, 2020 12:00 am

Re: IF

Postby stefano » Thu Mar 12, 2020 11:03 pm

Try

if len(alltrim(cUserName )) > 0
FWH 14.11 + xHarbour + bcc582
stefano
 
Posts: 80
Joined: Tue Mar 25, 2008 9:03 pm
Location: ITALIA

Re: IF

Postby Antonio Linares » Fri Mar 13, 2020 3:44 am

Luis,

Code: Select all  Expand view
If ! cUserName == ""
   ? "Not Empty"
Else
   ? "Empty"
EndIf
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41449
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: IF

Postby MarcoBoschi » Sat Mar 14, 2020 4:01 pm

Code: Select all  Expand view

[#include "Set.ch"
FUNCTION MAIN()

? set(_SET_EXACT )
cUserName := "Luis"

If cUserName <> ""
? "Not Empty"
Else
? "Empty"
EndIf

SET EXACT ON
? set(_SET_EXACT )

cUserName := "Luis"

If cUserName <> ""
? "Not Empty"
Else
? "Empty"
EndIf


RETURN NIL
 




SET EXACT
Determines the mode for character string comparison.
Syntax
SET EXACT on | OFF | ( <lOnOff> )

Arguments
on | OFF | ( <lOnOff> )
on | OFF | ( <lOnOff> )
This option toggles if an exact comparison is performed with character strings. or not.
The default is OFF or .F. (false), i.e. characters are compared up the length of the shorter string.
To change the setting use ON or .T. (true) as parameter.
The parameter can also be specified as a logical expression enclosed in parentheses.
User avatar
MarcoBoschi
 
Posts: 1027
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: IF

Postby luiscambuston » Sat Mar 14, 2020 10:39 pm

Basically this ! variable == "" works
This variable <> "" does not
this variable != "" does not....
luiscambuston
 
Posts: 22
Joined: Mon Mar 02, 2020 12:00 am


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 11 guests