Copyright (c) 2019-2024 Sempare Limited
-
char functions
-
date functions
-
dataset functions
-
encoding/decoding functions
-
hashing functions
-
misc functions
-
numeric functions
-
string functions
-
type functions
<% chr(10) %>
<% ord('a') %>
<% dtnow() %>
Formats a date time using FormatDateTime
<% fmtdt('yyyy-mm-dd', dtnow()) %>
For formatting options, see http://docwiki.embarcadero.com/Libraries/Rio/en/System.SysUtils.FormatDateTime#Description
return true if the object is a TDataSet<% isdataset(ds) %>
<% RecordCount(ds) %>
<% base64decode('aGVsbG8gd29ybGQ=') %>
<% base64encode('hello world') %>
<% htmlescape('<a href="https://www.google.com">google</a>') %>
<% htmlunescape('&lt;a href=&quot;https://www.google.com&quot;&gt;google&lt;/a&gt;') %>
<% md5('hello world') %>
<% sha1('hello world') %>
<% sha1('hello world') %>
<% isempty(list) %>
<% isempty(dict) %>
<% isempty(queue) %>
<% isempty(stack) %>
<% isempty(dataset) %>
<% containskey({}, "key") %> // false
<% containskey({"key":"value"}, "key") %> // true
<% name := '' %>
<% default(name, 'joe bloggs') %>
This works with records and classes, where the function inspects the structure for an 'id' field.
type
TMyRec = record
id : string;
end;
...
var LRec : TMyRec;
LRec.id := '123';
var LResult := Template.Parse('<% domid(_) %>', LRec); // TMyRec_123
LResult := Template.Parse('<% domid(_, ''ctx'') %>', LRec); // ctx_TMyRec_123
<% a := manage(aFuncCreatingAnObject()) %>
Also see unmanage(object)
Sorts basic arrays of integer, double, extended and string or something enumerable of these types.<% values := sort(split('g,f,d,s,d,a', ',')) %>
<% templateexists('template') %>
<% a := manage(aFuncCreatingAnObject()) %>
<% unmanage(a) %>
<% a.free() %>
<% abs(-123.45) %>
<% min(1,2) %>
<% max(1,2) %>
<% crnl(2) %>
<% endswith('heLlo', 'lo') %>
<% fmt('%s %s %d', 'hello','world', 123) %>
For formatting options, see: http://docwiki.embarcadero.com/Libraries/Rio/en/System.SysUtils.Format#Format_Strings
Return the length of a string or an array.<% len('hello world') %>
<% lowercase('heLlo') %>
<% match('aaaaaaaaaaaaaa', 'a+') %>
For more information, see http://docwiki.embarcadero.com/Libraries/Rio/en/System.RegularExpressions.TRegEx.Matches
return a string with len #10<% nl(2) %>
<% padleft('123', 6) %>
<% padright('123', 6) %>
<% replace('a', 'hello ', 'aaa') %>
<% rev('abc') %>
<% spaces(2) %>
<% split('hello world', ' ')[0] %>
<% startswith('heLlo', 'he') %>
<% substr(' hello ', 2, 5) %>
<% substring(' hello ', 2, 6) %>
<% tabs(2) %>
Remove whitespace from a string.
<% trim(' hello ') %>
<% ucfirst('hello') %>
<% uppercase('heLlo') %>
<% bool(true) %> // true
<% bool('true') %> // false
<% bool(false) %> // true
<% bool('false') %> // false
<% bool(1) %> // false
<% bool(0) %> // false
<% bool(10) %> // false
<% bool(-10) %> // false
<% bool(1.23) %> // false
<% int(123.45) %>
<% int('123.45') %>
<% num(true) %> // 1
<% num(10) %> // 10
<% num('123') %> // 123<br>
<% num('1e6') %> //1000000
<% str(123) + ' = one two three' %>
<% isbool(true) %> // true
<% isbool('true') %> // false
<% isbool(false) %> // true
<% isbool('false') %> // false
<% isbool(1) %> // false
<% isbool(0) %> // false
<% isbool(1.23) %> // false
<% isint(123) %> // true
<% isint(123.45) %> // false
<% isint('123.45') %> // false
<% isnil(dataset) %> //
<% isnum(123) %> // true
<% isnum(123.45) %> // true
<% isnum('123.45') %> // false
<% ismap(123) %> // false
<% ismap({}) %> // true
<% ismap({"a":123}) %> // true
<% isobject(obj) %>
<% isrecord(obj) %>
<% isstr(123) %> // false
<% isstr(bool) %> // false
<% isstr('123.45') %> // true
<% typeof(true) %> // System.Boolean
<% typeof(123) %> // System.Extended
<% typeof(123.45) %> // System.Extended
<% typeof('test') %> // System.string