5.3 String and Environment variable Literals

In Gforth (since 1.0) you can input a string by surrounding it with " (e.g. "abc", "a b"). The result is the starting address and byte (=char) count of the string on the data stack.

You have to escape any " inside the string with \ (e.g., "double-quote->\"<-"). In addition, this string syntax supports all the ways to write control characters that are supported by s\" (see String and Character literals). A disadvantage of this string syntax is that it is non-standard; for standard programs, use s\" instead.

In Gforth (since 1.0) you can input an environment variable by surrounding its name with ${...}, e.g., ${HOME}; the result is a string descriptor on the data stack in the format described above. This is equivalent to "HOME" getenv, i.e., the environment variable is resolved at run-time.