by Deadron
Various text-related functions you might find useful, including reading files into lists and replacing words in strings. [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Deadron.TextHandling##version=5

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:


Version 5
Date added: Jul 12 2001
Last updated: Jul 29 2009
18 fans
Text-related functions you might find useful. The library contains full documentation and examples. If you are looking to sort text, check out my List library.

dd_file2list(file_path, separator = "\n")
dd_replacetext(text, search_string, replacement_string)
dd_replaceText(text, search_string, replacement_string)
dd_hasprefix(text, prefix)
dd_hasPrefix(text, prefix)
dd_hassuffix(text, suffix)
dd_hasSuffix(text, suffix)
dd_text2list(text, separator)
dd_text2List(text, separator)
dd_list2text(list/the_list, separator)
dd_centertext(message, length)
dd_limittext(message, length)


Tsfreaks: (Aug 26 2009, 9:09 pm)
Great library!

I came across a low pri usability issue.

If you forget to include the delimiter (ahem) for dd_text2list, the Dream Daemon gets stuck in a loop and you are directed toward a function in Text_Handling. A user friendly change might be to force an exception with information about the missing parameter.