FutureBasic Logo

<<    Index    >> FutureBasic

str#   function

stringFromList$ = str#(resourceID, index)

This function returns a string element from a resource of type "str#". The resourceID should specify the resource ID number of an "str#" resource in a currently open resource file. index indicates which string element to get; the first element is numbered 1. If the "str#" resource 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.
"str#" resources hold lists of strings. Among other things, they're useful in helping you to localize your program so that it supports the native language of your user. You typically use a program like ResEdit to create an "str#" resource and its strings.

You can use the following function to determine how many strings are in an "str#" resource.

local fn GetSTRcount( resID )
resHndl = fn GETRESOURCE( _"str#", resID )
if resHndl
resCount = {[resHndl]} // Get 1st word in block
resCount = 0 // Couldn't get the resource
end if
end fn = resCount

See also
compile _strResource; str&