Page 1 of 1

String Funktion

Posted: Thu Dec 30, 2004 11:25 am
by Vater
Hello NG,

I try to use the String Function to fill a String Variable.
Here is my Code:

VName$ = String(255, Chr(0))
Serial$ = String(255, Chr(0))
FSName$ = String(255, Chr(0))

GetVolumeInformation_("C:\", VName$, 255, Serial$, 0, 0, FSName$, 255)
CallDebugger
Debug VName$
Debug Serial$
Debug FSName$
OpenConsole()
PrintN(VName$)
PrintN(Serial$)
PrintN(FSName$)
Input()

I get the Error String is not a function, an array or a linked list.
Any Ideas??
Thanks for all your help

Stefan
CloseConsole()
End

Posted: Thu Dec 30, 2004 11:38 am
by Pupil
You get this error because, in fact, there is no such command in PB, check the help file(very useful sometimes!). However you can can use Space() to the same effect in the code you posted.

Posted: Thu Dec 30, 2004 11:43 am
by Vater
Thanks for the quick answer but (I Work with jaPBE) when i type the String() Command I get a quick reference saying
Stirng(Count, Char$) - Multiply char [Math and Strings.pbi]
I'm new to PB, do I need to link to this pbi File somehow??

Stefan

Posted: Thu Dec 30, 2004 11:50 am
by thefool
Oh you are correct. JaPBe has some includes that one can use.
If you click Project -> project options and click the tab "Includes", you can see a list of some that comes with japbe. If you tick the box with "Math and Strings", you should be able to use this function.

String Funktion

Posted: Thu Dec 30, 2004 12:43 pm
by Vater
That's it, thanks
Stefan

Re: String Funktion

Posted: Thu Dec 30, 2004 7:39 pm
by PB
> VName$ = String(255, Chr(0))

In addition to what thefool said, it also must be mentioned that you cannot
use Chr(0) in strings, as that is used to terminate a string. If you need to
fill a string, better to use something like Space(255) instead (to fill it with
255 spaces).

Code: Select all

a$=Chr(0)+Chr(0)+Chr(0)
Debug Len(a$) ; Returns 0, not 3.