Skip to main content

Reference

 

OutSystems

Text Built-in Functions

Name Description
Chr(​Integer) Returns a single-character string corresponding to the 'c' character code.
Concat(​Text, Text) Returns the concatenation of two Texts: 't1' and 't2'.
EncodeHtml(​Text) Returns a string with all the reserved characters translated in order to be used in HTML literals.

Using un-escaped expressions without encoding distrusted variables (e.g. user input) compromises the end-user security by allowing HTML and JavaScript injection as well as cross-scripting. You should use this function when managing un-escaped expressions.
EncodeJavaScript(​Text) Returns a string with all reserved characters translated in order to be use in Javascript literals.

Using un-escaped expressions without encoding distrusted variables (e.g. user input) compromises the end-user security by allowing JavaScript injection as well as cross-scripting.
You should use this function when managing un-escaped expressions.
EncodeSql(​Text) Returns a string with special characters translated in order to be used in SQL literals.
Using expand inline parameters without encoding distrusted variables (e.g. user input) compromises the database security by allowing SQL injection.
You should use this function when managing in-line parameters in your SQL query.
EncodeUrl(​Text) Returns a string with all non-alphanumeric characters coded in order to be used in URL parameter values. Only alphanumeric characters [0-9a-zA-Z] can be un-encoded in the URL. For a matter of security, you should use this encoding function when managing URLs in your application. For example, when you want to add a dynamic URL to an external site.
Index(​Text, Text, Integer, Boolean, Boolean) Returns the zero-based position in Text 't' where 'search' Text can be found. Returns -1 if 'search' is not found or if 'search' is empty.
Length(​Text) Returns the number of characters in Text 't'.
NewLine() Returns a string containing the New Line (Return) character.
Replace(​Text, Text, Text) Returns Text 't' after replacing all Text occurrences of 'search' with 'replace'.
Substr(​Text, Integer, Integer) Returns a sub-string of 't' beginning at 'start' zero-based position and with 'length' characters.
ToLower(​Text) Converts Text 't' to the equivalent lowercase text.
ToUpper(​Text) Converts Text 't' to the equivalent uppercase text.
Trim(​Text) Removes all leading and trailing white spaces from Text 't'.
TrimEnd(​Text) Removes all trailing white spaces from Text 't'.
TrimStart(​Text) Removes all leading white spaces from Text 't'.

Chr

Returns a single-character string corresponding to the 'c' character code.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Function is evaluated before the aggregate is executed.
  • Local Storage: Function is evaluated before the aggregate is executed.

Parameters

c
Type: Integer. Mandatory.
The ASCII code value to be converted to a character.

Output

Type: Text

Examples

Chr(88) = "X"

Concat

Returns the concatenation of two Texts: 't1' and 't2'.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t1
Type: Text. Mandatory.
The first string.
t2
Type: Text. Mandatory.
The string that will be appended to the first string in the output.

Output

Type: Text

Examples

Concat("First string", "last string") = "First stringlast string"
Concat("", "") = ""

EncodeHtml

Returns a string with all the reserved characters translated in order to be used in HTML literals.

Using un-escaped expressions without encoding distrusted variables (e.g. user input) compromises the end-user security by allowing HTML and JavaScript injection as well as cross-scripting. You should use this function when managing un-escaped expressions.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Function is evaluated before the aggregate is executed.
  • Local Storage: Function is evaluated before the aggregate is executed.

Parameters

text
Type: Text. Mandatory.
The Text to be encoded.

Output

Type: Text

Examples

EncodeHtml("<>") = "<>"
EncodeHtml("another ' test") = "another ' test"
EncodeHtml("another "" test") = "another " test"
EncodeHtml("Hello" + NewLine() + "World!") = "Hello<br/>World!"

EncodeJavaScript

Returns a string with all reserved characters translated in order to be use in Javascript literals.

Using un-escaped expressions without encoding distrusted variables (e.g. user input) compromises the end-user security by allowing JavaScript injection as well as cross-scripting.
You should use this function when managing un-escaped expressions.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Function is evaluated before the aggregate is executed.
  • Local Storage: Function is evaluated before the aggregate is executed.

Parameters

text
Type: Text. Mandatory.
The Text to be encoded.

Output

Type: Text

Examples

EncodeJavascript("another ' test") = "another \x27 test"
EncodeJavascript("<>") = "\x3c\x3e"

EncodeSql

Returns a string with special characters translated in order to be used in SQL literals.
Using expand inline parameters without encoding distrusted variables (e.g. user input) compromises the database security by allowing SQL injection.
You should use this function when managing in-line parameters in your SQL query.

Available in:

  • Server-side logic: Yes
  • Client-side logic: No
  • Database: Function is evaluated before the aggregate is executed.
  • Local Storage: Function is evaluated before the aggregate is executed.

Parameters

text
Type: Text. Mandatory.
The Text to be encoded.

Output

Type: Text

Examples

EncodeSql("another ' test") = "another '' test"

EncodeUrl

Returns a string with all non-alphanumeric characters coded in order to be used in URL parameter values. Only alphanumeric characters [0-9a-zA-Z] can be un-encoded in the URL. For a matter of security, you should use this encoding function when managing URLs in your application. For example, when you want to add a dynamic URL to an external site.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Function is evaluated before the aggregate is executed.
  • Local Storage: Function is evaluated before the aggregate is executed.

Parameters

text
Type: Text. Mandatory.
The Text to be encoded.

Output

Type: Text

Examples

EncodeUrl(" test") = "+test"
EncodeUrl("another ' test") = "another+%27+test"
EncodeUrl("<>") = "%3c%3e"
EncodeUrl("1+2") = "1%2b2"
EncodeUrl("Company A&A") = "Company+A%26A"

Index

Returns the zero-based position in Text 't' where 'search' Text can be found. Returns -1 if 'search' is not found or if 'search' is empty.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text where the search Text can be found.
search
Type: Text. Mandatory.
The Text string to be found.
startIndex
Type: Integer.
Indicates the (zero-based) index where the search starts. In case of searching from the end to the start, a startIndex different from 0 (zero) indicates the end of the text. The default value is 0 (zero). When used in Aggregates this parameter is not present.
searchFromEnd
Type: Boolean.
Indicates the direction of the search. In case of searching from the end to the start, a startIndex different from 0 (zero) indicates the end of the text. The default value is False. When used in Aggregates this parameter is not present.
ignoreCase
Type: Boolean.

Output

Type: Integer

Examples

Index("First string", "F") = 0
Index("First string", "st") = 3
Index("First string", "xx") = -1
Index("First string", "F", startIndex: 5) = -1
Index("First string", "st", startIndex: 5) = 6
Index("First string", "xx", startIndex: 5) = -1
Index("First string", "F", searchFromEnd: True) = 0
Index("First string", "st", searchFromEnd: True) = 6
Index("First string", "xx", searchFromEnd: True) = -1
Index("First string", "f") = -1
Index("First string", "f", ignoreCase: True) = 0
Index("", "xx") = -1
Index("First string", "") = -1
Index("", "") = -1

Length

Returns the number of characters in Text 't'.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text to calculate the length of.

Output

Type: Integer

Examples

Length("First string") = 12
Length("") = 0

NewLine

Returns a string containing the New Line (Return) character.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Function is evaluated before the aggregate is executed.
  • Local Storage: Function is evaluated before the aggregate is executed.

Output

Type: Text

Replace

Returns Text 't' after replacing all Text occurrences of 'search' with 'replace'.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text where the search and replace operation is performed.
search
Type: Text. Mandatory.
The Text to be replaced.
replace
Type: Text. Mandatory.
The Text that replaces the search Text.

Output

Type: Text

Examples

Replace("First string", "xx", "") = "First string"
Replace("First string", "First", "Second") = "Second string"
Replace("First string", "First", "") = " string"

Substr

Returns a sub-string of 't' beginning at 'start' zero-based position and with 'length' characters.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text where the operation is performed.
start
Type: Integer. Mandatory.
The zero-based position to start the Text extraction from.
length
Type: Integer. Mandatory.
The number of characters to include in the output Text.

Output

Type: Text

Examples

Substr("First string", 2, 4) = "rst "
Substr("First string", 0, 100) = "First string"
Substr("First string", 11, 3) = "g"
Substr("First string", Length("First string"), 0) = ""
Substr("First string", 2, 0) = ""

ToLower

Converts Text 't' to the equivalent lowercase text.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
Thet Text to transform into lowercase.

Output

Type: Text

Examples

ToLower("First string") = "first string"

ToUpper

Converts Text 't' to the equivalent uppercase text.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text to transform into uppercase.

Output

Type: Text

Examples

ToUpper("First string") = "FIRST STRING"

Trim

Removes all leading and trailing white spaces from Text 't'.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text to trim.

Output

Type: Text

Examples

Trim(" First string ") = "First string"
Trim("First string ") = "First string"

TrimEnd

Removes all trailing white spaces from Text 't'.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text to remove trailing white spaces from.

Output

Type: Text

Examples

TrimEnd(" First string ") = " First string"
TrimEnd("First string ") = "First string"

TrimStart

Removes all leading white spaces from Text 't'.

Available in:

  • Server-side logic: Yes
  • Client-side logic: Yes
  • Database: Can be used with attributes in aggregates.
  • Local Storage: Can be used with attributes in aggregates.

Parameters

t
Type: Text. Mandatory.
The Text to remove leading white spaces from.

Output

Type: Text

Examples

TrimStart(" First string ") = "First string "
TrimStart("First string ") = "First string "
  • Was this article helpful?