Fortinet Document Library

Version:

Version:

Version:

Version:


Table of Contents

Handbook

Download PDF
Copy Link

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.format
  • string.gmatch
  • string.gsub
  • string.len
  • string.lower
  • string.match
  • string.rep
  • string.reverse
  • string.sub
  • string.upper
  • string.starts_with
  • string.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.match with Lua patterns.
  • All relational operators >, <, >=, <=, ~=, == apply to strings. Especially, == can be used to test if one string equals to another string.
  • string.find can 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.

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.format
  • string.gmatch
  • string.gsub
  • string.len
  • string.lower
  • string.match
  • string.rep
  • string.reverse
  • string.sub
  • string.upper
  • string.starts_with
  • string.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.match with Lua patterns.
  • All relational operators >, <, >=, <=, ~=, == apply to strings. Especially, == can be used to test if one string equals to another string.
  • string.find can 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.