Futurebasic/Language/Reference/stringlist

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

STRINGLIST[edit | edit source]

Syntax[edit | edit source]

STRINGLIST ON STRINGLIST OFF STRINGLIST STRINGLIST = resID [,ResourceName$] STRINGLIST OPT STRINGLIST NOPT STRINGLIST END

Description[edit | edit source]

When source code is compiled, FB needs to know where to store quoted strings. (Quoted strings are those that appear in the source code like "Hello".) The strings are placed either in a STR# resource (for easy access during localization) or in blocks of data that are stored as part of the program.

  • STRINGLIST ON: Use this command to begin storing strings in a STR# resource.
  • STRINGLIST OFF: Use this command to stop storing strings in a STR# resource and to place them in a block that becomes part of the compiled application.
  • STRINGLIST: Use this command to restore the STRINGLIST state to whatever it was before a STRINGLIST ON, STRINGLIST OFF, or STRINGLIST = statement.
  • STRINGLIST = resID [,ResourceName$]: After the compiler sees this statement, subsequent strings will be stored in a STR# resource with an ID of resID and, optionally, a name of ResourceName$.
  • STRINGLIST OPT: This statement optimizes the string list so that there are no duplicates. It optimizes both resource based (STRINGLIST ON) and code based (STRINGLIST OFF) storage. This is the most desirable state and leads to smaller applications. When the compiler sees a string appear for a second time in your source code, it will not make a new entry, but will point to the existing identical entry.
  • STRINGLIST NOPT: Use this command to turn optimization of string off. In this case, the compiler will store separate entries for every occurrence of a string even if those occurrences are identical.
  • STRINGLIST END: This statement closes out the addition of strings to the current STR# resource and creates a new STR# (or uses an existing STR#) at the next consecutive ID.

Note[edit | edit source]

STRINGLIST statements are not nestable. STRINGLIST statements don't apply for string constants.