Scroll to navigation

GOLF(2gg) Development GOLF(2gg)

NAME

delete-string - (strings)

PURPOSE

Free string memory.

SYNTAX

delete-string <string> 

DESCRIPTION

delete-string frees <string> variable previously allocated by a Golf statement.

Note that freeing memory is in most cases unnecessary as Golf will automatically do so at the end of each request. You should have a good reason for using delete-string otherwise.

Golf keeps count of <string> references for process-scoped memory (see memory-handling), and such memory will be deleted at the end of the request once reference count reaches zero.

For non-process-scoped memory, if <string> is referenced by other variables, then <string> may not be deleted. Regardless of whether the memory referenced by <string> is actually deleted or not, <string> becomes an empty string ("") after delete-string.

EXAMPLES

Allocate and free random string:

random-string to ran_str
...
delete-string ran_str

Free string allocated by write-string (consisting of 100 "Hello World"s):

write-string ws

start-loop repeat 100
@Hello World
end-loop end-write-string ... delete-string ws

SEE ALSO


Strings

concatenate-strings copy-string count-substring delete-string lower-string new-string read-split replace-string set-string split-string string-length trim-string upper-string write-string See all documentation

$VERSION $DATE