FutureBasic Logo

<<    Index    >> FutureBasic

str&   function

stringFromHandle$ = str&(handle, index)

This function returns a string element from a handle that is in the same format as a resource of type "str#". The handle should specify the location of the memory block. index indicates which string element to get; the first element is numbered 1. If the handle isn't found, or if index is greater than the number of strings in the resource, the str& function returns an empty (zero-length) string.

This example creates and fills a handle in the form of a str# resource and displays the results..

dim sHndl as handle
dim x as word
// create an empty str# style handle
sHndl = fn NewHandleClear(2)
// Fill the handle with ASCII strings (1-10)
for x = 1 to 10
def ApndStr("This is number"+str$(x), sHndl)
// Display the handle using str&
for x = 1 to 10
print str&(sHndl,x)
// We made it. We must dispose of it.

See also
compile _strResource; str#