[SOLVED] Substrings in ZMSQL lazarus / 63-Database ---------------------------------------------------------------------- maurobio · 2021-09-20 22:13 Dear ALL, Many dialects of SQL (MySQL, SQLite, etc.) have a handy SUBSTR() function which extract a substring from a string (starting at any position), for example: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT SUBSTR(CustomerName, 2, 5) AS ExtractString FROM Customers; However, the ZMSQL library (https://wiki.freepascal.org/ZMSQL) offers two rather unusual variations of this function, as follows: Quotesubstr_after(source, substring) Returns the part of source that comes after substring. If substring is not found an empty string is returned. substr_before(source, substring) Returns the part of source that comes before substring. If substring is not found an empty string is returned. I do not understand how these functions work and have not been able to find any examples. Could some one provides me with a few hints? Thanks in advance! With best wishes, ---------------------------------------------------------------------- paweld · 2021-09-21 05:50 mid(expression, from, count) : https://github.com/git- bee/janSQL/blob/master/doc/6_functions.md#64-string-functions Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT string_col, mid(string_col, 2, 5) FROM TABLE ---------------------------------------------------------------------- maurobio · 2021-09-21 11:21 Dear @paweld, Thanks a lot, it is now clear and it works fine! With best wishes,