STR#
Syntax
stringFromList$ = STR#(resourceID%, index%)
Description
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 also add strings to an "STR#
" resource using the DEF APNDSTR
statement, or remove them using the DEF REMOVESTR
statement.
Note
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%)
LONG IF resHndl&
<spacer type="horizontal" size="48">resCount% = {[resHndl&]}'Get 1st word in block
XELSE
<spacer type="horizontal" size="48">resCount% = 0<spacer type="horizontal" size="15">'Couldn't get the resource
END IF
END FN = resCount%
See Also
DEF APNDSTR; DEF REMOVESTR; COMPILE _strResource; STR&