🔗SYNOPSIS a library of string utilities for use in darktable lua scripts
🔗USAGE local ds = require "lib/dtutils.string" 🔗DESCRIPTION This library contains string manipulation routines to aid in building darktable lua scripts.
🔗RETURN VALUE ds - library - the darktable lua string library
🔗FUNCTIONS 🔗escape_xml_characters escape characters for xml documents
🔗is_not_sanitized check if a string has been sanitized
🔗sanitize surround a string in quotes making it safe to pass as an argument</description>
🔗USAGE local ds = require &quot;lib/dtutils.string&quot; local result = ds.escape_xml_characters(str) str - string - the string that needs escaped
🔗DESCRIPTION escape_xml_characters provides the escape sequences for
&quot;&amp;&quot;, '&quot;', &quot;'&quot;, &quot;&lt;&quot;, and &quot;&gt;&quot; with the corresponding
&quot;&amp;amp;&quot;,&quot;&amp;quot;&quot;, &quot;&amp;apos;&quot;, &quot;&amp;lt;&quot;, and &quot;&amp;gt;&quot; .
🔗RETURN VALUE result - string - the string containing escapes for the xml characters
🔗USAGE local ds = require &quot;lib/dtutils.string&quot; local result = ds.is_not_sanitized(str) str - string - the string that needs to be made safe
🔗DESCRIPTION is_not_sanitized checks a string to see if it has been made safe use passing as an argument in a system command.
🔗RETURN VALUE result - boolean - true if the string is not sanitized otherwise false</description>
🔗SYNOPSIS escape lua &lsquo;magic&rsquo; characters from a pattern string
🔗USAGE local ds = require &quot;lib/dtutils.string&quot; local result = ds.sanitize_lua(str) str - string - the string that needs to be made safe
🔗DESCRIPTION sanitize_lua escapes lua &lsquo;magic&rsquo; characters so that a string may be used in lua string/patten matching.
🔗RETURN VALUE result - string - a lua pattern safe string</description>
🔗USAGE local ds = require &quot;lib/dtutils.string&quot; local result = ds.strip_accents(str) str - string - the string with characters that need accents removed
🔗DESCRIPTION strip_accents removes accents from accented characters returning the unaccented character.
🔗RETURN VALUE result - string - the string containing unaccented characters
🔗REFERENCE Copied from https://forums.coronalabs.com/topic/43048-remove-special-characters-from-string/</description>
🔗USAGE local ds = require &quot;lib/dtutils.string&quot; local result = ds.urlencode(str) str - string - the string that needs to be made websafe
🔗DESCRIPTION urlencode converts a string into a websafe version suitable for use in a web browser.