String library
The FortiADC OS supports only the Lua string library. All other libraries are disabled. The string library includes the following string-manipulation functions:
string.byte(s, i)string.char(i1,i2…)string.dump(function)string.find(s, pattern)string.formatstring.gmatchstring.gsubstring.lenstring.lowerstring.matchstring.repstring.reversestring.substring.upperstring.starts_withstring.ends_with
For example: uri:starts_with (b), uri:ends_with (b)
Note:
- If you want to do regular expression match, you can use
string.matchwith Lua patterns. - All relational operators >, <, >=, <=, ~=, == apply to strings. Especially, == can be used to test if one string equals to another string.
string.findcan be used to test whether one string contains another string.
For a tutorial on scripting with the Lua string library, see http://lua-users.org/wiki/StringLibraryTutorial.