String Commands (Template Language)

String and text commands defined in Software Ideas Modeler Template Language.
Command Result Type Description
Concat(...texts:String) String

Concatenates multiple string parameters into a single string.

Parameters: A comma-separated list of string values to concatenate.

Example: Concat("Hello", " ", "World") returns "Hello World".

Contains(target:String, text:String) Boolean

Checks if the target string contains the specified text.

Parameters: The target string to search within, and the text to search for.

Example: Contains("Hello World", "World") returns true.

EndsWith(target:String, text:String) Boolean

Checks if the target string ends with the specified text.

Parameters: The target string to check, and the text to verify at the end of the target string.

Example: EndsWith("Hello World", "World") returns true.

FirstCharToLower(target:String) String

Converts the first character of the target string to lowercase.

Parameter: The target string whose first character will be converted to lowercase.

Example: FirstCharToLower("Hello") returns "hello".

FirstCharToUpper(target:String) String

Converts the first character of the target string to uppercase.

Parameter: The target string whose first character will be converted to uppercase.

Example: FirstCharToUpper("hello") returns "Hello".

Follows(target:String, text1:String, text2:String, [text3:String]) Boolean

Returns true if text2 appears after text1 within the target string, and text3 (if defined) does not appear between text1 and text2.

Parameters: The target string to search within, the first text to locate, the second text that should follow the first, and an optional third text that should not appear between the first and second texts.

Example: Follows("This is a test string", "This", "test", "a") returns true because "test" follows "This" and "a" is between them.

GetPlural(target:String) String

Returns a plural form of the target string based on simple heuristic rules.

Parameter: The target string to pluralize.

Example: GetPlural("cat") returns "cats".

IsBlank(target:String) Boolean

Returns true if the target string is null, empty, contains only whitespace, or is not evaluated.

Parameter: The target string to check.

Example: IsBlank(" ") returns true.

IsEmpty Boolean

Returns true if the target string is null, empty, or not evaluated.

Parameter: The target string to check.

Example: IsEmpty("") returns true.

Join(separator:String, ...texts:String) String

Joins multiple strings using the provided separator.

Parameters: The separator string to use between each text, followed by a comma-separated list of strings to join.

Example: Join(", ", "Hello", "World") returns "Hello, World".

Length(target:String) Number

Returns the length of the target string.

Parameter: The target string whose length will be returned.

Example: Length("Hello") returns 5.

Regex(target:String, regexPattern:String) Boolean

Performs a regular expression search within the target string based on the provided pattern.

Parameters: The target string to search within, and the regex pattern to match against the target.

Example: Regex("Hello World", "^Hello") returns true because the target string starts with "Hello".

RemoveEnd(target:String, text:String, caseSensitive:Boolean) String

Removes the specified text from the end of the target string if it matches. The operation can be case-sensitive or case-insensitive based on the provided boolean value.

Parameters: The target string from which to remove text, the text to remove, and a boolean indicating whether the removal should be case-sensitive (true) or case-insensitive (false).

Example: RemoveEnd("Hello World", "World", true) returns "Hello ".

RemoveSpaces(target:String) String

Removes all spaces from the target string.

Parameter: The target string from which spaces will be removed.

Example: RemoveSpaces("Hello World") returns "HelloWorld".

RemoveStart(target:String, text:String, caseSensitive:Boolean) String

Removes the specified text from the start of the target string if it matches. The operation can be case-sensitive or case-insensitive based on the provided boolean value.

Parameters: The target string from which to remove text, the text to remove, and a boolean indicating whether the removal should be case-sensitive (true) or case-insensitive (false).

Example: RemoveStart("Hello World", "Hello", false) returns " World".

Replace(target:String, oldText:String, newText:String) String

Replaces all occurrences of oldText in the target string with newText.

Parameters: The target string to modify, the text to be replaced, and the text to replace with.

Example: Replace("Hello World", "World", "There") returns "Hello There".

ResetUniqueNames Void

Clears the unique names collection, resetting the state for generating unique names.

StartsWith(target:String, text:String) Boolean

Checks if the target string starts with the specified text.

Parameters: The target string to check, and the text to verify at the start of the target string.

Example: StartsWith("Hello World", "Hello") returns true.

Substring(target:String, index:Number, [length:Number]) String

Extracts a substring from the target string starting at the specified index. If length is provided, it returns that many characters; otherwise, it returns the rest of the string from the index.

Parameters: The target string, the starting index (zero-based), and an optional length of the substring.

Example: Substring("Hello World", 6, 5) returns "World".

ToLower(target:String) String

Converts the entire target string to lowercase letters.

Parameter: The target string to convert.

Example: ToLower("HELLO WORLD") returns "hello world".

ToSingleLine(target:String) String

Removes all line breaks from the target string, converting it to a single line of text.

Parameter: The target string from which line breaks will be removed.

Example: ToSingleLine("Hello\nWorld") returns "HelloWorld".

ToUpper(target:String) String

Converts the entire target string to uppercase letters.

Parameter: The target string to convert.

Example: ToUpper("hello world") returns "HELLO WORLD".

Trim(target:String) String

Removes leading and trailing whitespace from the target string.

Parameter: The target string to trim.

Example: Trim(" Hello World ") returns "Hello World".

UniqueName(target:String) String

Returns the input string if it is unique within the current context; otherwise, it appends an index number to make it unique. The target string is added to the unique names collection after using this command.

Parameter: The target string to ensure uniqueness for.

Example: If "name" is already used, UniqueName("name") might return "name1".

New Comment

Comment