Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

ends-with() Function (SLAX)

Namespaces

SLAX Syntax

Description

Return true if the string ends with the specified substring. This function is useful for testing for file extensions and other trailing strings.

Parameters

string

String to test if it ends with the given substring.

substring

Substring to check for at the end of the test string.

Return Value

boolean

Boolean value, which is true if the string ends with the specified substring. Otherwise, the function returns false.

Usage Examples

The following example presents a simple script that reviews each op script filename in the configuration. The ends-with function tests if a script is a Python script (ends with .py) or a SLAX script (ends with .slax).

Release Information

Function introduced in SLAX version 1.3.