Add support for 'substr' string function - lib changes