Futurebasic/Language/Reference/str amp

From Wikibooks, open books for an open world
Jump to navigation Jump to search

STR&[edit | edit source]

Syntax[edit | edit source]

stringFromHandle$ = STR&(handle&, index%)

Revised[edit | edit source]

June 2001 (Release 5)

Description[edit | edit source]

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.

Example[edit | edit source]

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)

NEXT

// Display the handle using STR& FOR x = 1 TO 10
  PRINT str&(sHndl,x)

NEXT

// We made it. We must dispose of it.

DEF DISPOSEH(sHndl)

See Also[edit | edit source]

DEF APNDSTR; DEF REMOVESTR; COMPILE _strResource; STR#