What is the Basic code to create a blank string (say 10 bytes) and a null string ?
What is the code to test for either a blank or a null string ?
Also
I want an AND condition ... If A = 1 AND B = 2 etc....
How is this coded ?
Thanks in advance
Create and test for blank and null string. AND condition
Moderators:Administrator, Global Moderator
Re: Create and test for blank and null string. AND condition
I do not know if I understand your question. Here are some basic tips.
Code: Select all
COLOR 7, 3: CLS
A$ = STRING$(10, 32) 'Defines string with 10 characters space
PRINT "String A$: "; A$; LEN(A$); "bytes, Code ="; ASC(MID$(A$, 1, 1))
B$ = STRING$(10, 88) 'Defines string with 10 characters X
PRINT "String B$: "; B$; LEN(B$); "bytes, Code ="; ASC(MID$(B$, 1, 1))
C$ = "" 'Defines null string
PRINT "String C$: "; C$; LEN(C$); "bytes, null string"
A = 1
B = 2
C = A + B
IF A = 1 AND B = 2 THEN PRINT "A = 1 and B = 2"
PRINT "A ="; A; " B ="; B; " C ="; C
IF A = B THEN
PRINT "A is equal to B"
ELSE
PRINT "A is not equal to B"
END IF
Re: Create and test for blank and null string. AND condition
Just so you know, QB does not use null-terminated strings. So if you mean an empty string by "null string" then simply assign the value of "" to it:
If you're looking to create a "buffer", a quick way is the SPACE$() function
Your AND statement is perfectly valid the way you wrote it - just add a "THEN" at the end.
Code: Select all
MyString$ = ""
Code: Select all
MyString$ = SPACE$(10)
I take things apart. I break them. Then I put things that don't belong back inside them.