[Gambas-user] Why this simple program doesn't work

Alonzo Flinston francesco.difusco at ...69...
Sat Sep 17 13:09:36 CEST 2005


FUNCTION NumBinario(binario AS String) AS Boolean
DIM numbin AS Boolean
DIM i AS Integer
DIM n AS Integer
DIM cifra AS String
numbin = TRUE
n = Len(binario)
FORMMAIN.TextBox1.TEXT = n
i = 1
DO WHILE (i <= n AND numbin = TRUE)
cifra = Mid$(binario, i, 1)
IF (cifra <> "0" OR cifra <> "1") THEN
numbin = FALSE
ELSE
i = i + 1
ENDIF
LOOP
RETURN numbin
END

I have a string and I want to check if every character if a binary
digit, "0" or "1"

Thanks

Francesco

-- 
Teaching OnLine 
Corsi online di programmazione
Php, Asp, C, C++, Visual Basic, Delphi
Linux Shell Programming
------------------------------------
http://www.teachingonline.it





More information about the User mailing list