.. ******************************************************************************* * MetaFactory.io R2 * Technical Documentation * * File name : EL_StringFunctions.rst * Created by : Niels de Nies * * MetaFactory BV Amsterdam ******************************************************************************* .. include:: /inline-images.txt .. meta:: :description: MetaFactory Code Composer documentation :keywords: metafactory, code composer, documentation, reference, expression language, functions, build-in functions, string functions String functions ---------------- The following table shows the build-in functions in the expression language of the Code Composer related to Strings. .. list-table:: :widths: 40 60 :header-rows: 1 :class: tight-table * - Name - Description * - :ref:`allLower` - Converts all characters in a String to lower case. * - :ref:`allUpper` - Converts all characters in a String to upper case. * - :ref:`camelCaseToTitleFormat` - Converts String from camel case to title format * - :ref:`camelToAllUpperUnderscore` - Converts String from camel case to all upper case with underscores * - :ref:`camelToKebabCase` - Converts String from camel case to kebab case * - :ref:`camelToSnakeCase` - Converts String camel case to snake case. * - :ref:`firstLower` - Converts the first character in a String to lower case. * - :ref:`firstUpper` - Converts the first character in a String to upper case. allLower ~~~~~~~~ The following table shows the documentation of the allLower function. .. list-table:: allLower :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - allLower(String text) : String * - Description - Converts all characters in a String to lower case * - Arguments - text: String to be converted to all lower case * - Returns - argument String converted to all lower case * - Exceptions - none * - Example - allLower("appName") returns "appname" * - Usage - .. table:: :class: usagetable ============================== = ====================================== in code instructions (.xml) in snippets (.ftl) ============================== = ====================================== ${allLower(${object.name})} metafactory.allLower(modelObject.name) ============================== = ====================================== allUpper ~~~~~~~~ The following table shows the documentation of the allUpper function. .. list-table:: allUpper :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - allUpper(String text) : String * - Description - Converts all characters in a String to upper case * - Arguments - text: String to be converted to all upper case * - Returns - argument String converted to all upper case * - Exceptions - none * - Example - allUpper("appName") returns "APPNAME" * - Usage - .. table:: :class: usagetable ============================== = ====================================== in code instructions (.xml) in snippets (.ftl) ============================== = ====================================== ${allUpper(${object.name})} metafactory.allUpper(modelObject.name) ============================== = ====================================== camelCaseToTitleFormat ~~~~~~~~~~~~~~~~~~~~~~ The following table shows the documentation of the camelCaseToTitleFormat function. .. list-table:: camelCaseToTitleFormat :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - camelCaseToTitleFormat(String text) : String * - Description - convert string from camel case to title format The first word of the title and subtitle are uppercased, and major words have the first letter of the word capitalized. Example: Average Number of Donuts * - Arguments - text: string in camel case to be converted to title format * - Returns - argument string in camel case converted to title format * - Exceptions - none * - Example - camelCaseToTitleFormat(“appName”) returns “App Name”. * - Usage - .. table:: :class: usagetable ========================================= = ==================================================== in code instructions (.xml) in snippets (.ftl) ========================================= = ==================================================== ${camelCaseToTitleFormat(${object.name})} metafactory.camelCaseToTitleFormat(modelObject.name) ========================================= = ==================================================== camelToAllUpperUnderscore ~~~~~~~~~~~~~~~~~~~~~~~~~ The following table shows the documentation of the camelToAllUpperUnderscore function. .. list-table:: camelToAllUpperUnderscore :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - camelToAllUpperUnderscore(String text) : String * - Description - convert string from camel case to all upper case with underscores Example: AVERAGE_NUMBER_OF_DONUTS * - Arguments - text: string in camel case to be converted to all upper case with underscores * - Returns - argument string in camel case converted to all upper case with underscores * - Exceptions - none * - Example - camelToAllUpperUnderscore(“firstItem”) returns “FIRST_ITEM”. * - Usage - .. table:: :class: usagetable ============================================ = ========================================================= in code instructions (.xml) in snippets (.ftl) ============================================ = ========================================================= ${camelToAllUpperUnderscore(${object.name})} metafactory.camelToAllUpperUnderscore(modelObject.name) ============================================ = ========================================================= camelToKebabCase ~~~~~~~~~~~~~~~~ The following table shows the documentation of the camelToKebabCase function. .. list-table:: camelToKebabCase :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - camelToKebabCase(String text) : String * - Description - Converts String from camel case to kebab case. In kebab case all parts of a name are in lower case and connected by hyphens. Example: average-number-of-donuts * - Arguments - text: String in camel case to be converted to kebab case * - Returns - argument string converted to kebab case * - Exceptions - none * - Example - camelToKebabCase(“appName”) returns “app-name” * - Usage - .. table:: :class: usagetable =================================== = ============================================== in code instructions (.xml) in snippets (.ftl) =================================== = ============================================== ${camelToKebabCase(${object.name})} metafactory.camelToKebabCase(modelObject.name) =================================== = ============================================== camelToSnakeCase ~~~~~~~~~~~~~~~~ The following table shows the documentation of the camelToSnakeCase function. .. list-table:: camelToSnakeCase :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - camelToSnakeCase(String text) : String * - Description - Converts String from camel case to snake case. In snake case all parts of a name are in lower case and connected by underscores. Example: average_number_of_donuts * - Arguments - text: string in camel case to be converted to snake case * - Returns - argument string in camel case converted to snake case. * - Exceptions - none * - Example - camelToSnakeCase(“appName”) returns “app_name” * - Usage - .. table:: :class: usagetable =================================== = ========================================== in code instructions (.xml) in snippets (.ftl) =================================== = ========================================== ${camelToSnakeCase(${object.name})} metafactory.allLower(modelObject.name) =================================== = ========================================== firstLower ~~~~~~~~~~ The following table shows the documentation of the firstLower function. .. list-table:: firstLower :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - firstLower(String text) : String * - Description - Converts the first character of a String to lower case. * - Arguments - text : String of which first character needs to be converted to lower case * - Returns - argument String with first character converted to lower case * - Exceptions - none * - Example - firstLower("AppName") returns "appName" * - Usage - .. table:: :class: usagetable ============================== = ======================================== in code instructions (.xml) in snippets (.ftl) ============================== = ======================================== ${firstLower(${object.name})} metafactory.firstLower(modelObject.name) ============================== = ======================================== firstUpper ~~~~~~~~~~ The following table shows the documentation of the firstUpper function. .. list-table:: firstUpper :widths: 20 80 :header-rows: 0 :class: tight-table * - Category - expression language/functions/build-in functions/String functions * - Signature - firstUpper(String text) : String * - Description - Converts the first character in a String to upper case.. * - Arguments - text: String of which first character needs to be converted to upper case * - Returns - argument String with first character converted to upper case * - Exceptions - none * - Example - firstUpper("appName") returns "AppName" * - Usage - .. table:: :class: usagetable ============================== = ======================================== in code instructions (.xml) in snippets (.ftl) ============================== = ======================================== ${firstUpper(${object.name})} metafactory.firstUpper(modelObject.name) ============================== = ========================================