[Gambas-user] Catch NULL character

Benoît Minisini gambas at ...1...
Tue Apr 21 18:07:45 CEST 2009


> What is wrong with this line :-
>
> IF sElement[iLoop] = NULL THEN sElement[iLoop] = "0"
>
> I want to catch a null character and change it to "0".

Just as a summary:

NULL is NULL, a special constant (like TRUE or FALSE), that is the default 
value of Variant, String, Date and Object datatypes.

In Gambas, NULL and "" (the void string) are the same thing. Maybe you can 
find that confusing, but that makes a lot of code simpler to write.

But the "null" character is a bad name for Chr$(0), i.e. a byte in memory 
inside a string whose value is zero. 

So, Chr$(0) <> NULL !

-- 
Benoît




More information about the User mailing list