======= Functions ======= All these functions will manipulate character strings to fit your needs. Functions can use into conditional node and populate variable node and keep the result in a variable. There are 3 groups of functions :\\ -**Character string functions** -[[functions:mathematics_functions|Mathematics functions]] -[[functions:other_functions|Other functions]] ------ ===== Character string functions ===== * ALL string inputs containing alphabetic characters (a-z, A-Z) must be encapsulated with single or double quotes.\\ * If numeric character(s) (0-9) are used in functions that accept strings then the number will be treated as a string.\\ *All functions can be nested ([[character_string_functions#Nested functions|functions within functions]]).\\ Usage description : $function(input-1 = "string", input-2 = integer[, optional input-3 = "string"/integer]) * Escaping Doublequotes: If you need to provide a doublequote within your string, you need to escape them by just providing two doublequotes instead of one. Example: * your string is: [this is my "string"] * in a function, you need to use it this way: ["this is my ""string"""] * as you see, the string was wrapped into double quotes, just as any string inside functions. Additionally the real doublequotes in the string just have been doubled. *** If you want to read and store an entire text file (xml, txt, etc), see [[other_functions#$read|"$read" function]].** ===== $left vs $triml ===== *$left : Get string n-characters from the left side. *$triml : Trim string n-characters from the left side. Usages:\\ $left(input string = "string/%variable%", number of characters to extract = integer/%i_variable%)\\ $triml(input string = "string/%variable%", number of characters to trim = integer/%i_variable%) {{:functions:left-triml.jpg?nolink&800|}} ------ ===== $right vs $trimr ===== *$right : Get string n-characters from the right side. *$trimr : Trim string n-characters from the right side. Usages:\\ $right(input string = "string/%variable%", number of characters to extract = integer/%i_variable%)\\ $trimr(input string = "string/%variable%", number of characters to trim = integer/%i_variable%) {{:functions:right-trimr.jpg?nolink&800 |}} ------ ===== $middle vs $between ===== *$middle : Get string n-characters from n-position. *$between: Get string between two strings. Usages:\\ $middle(input string = "string/%variable%", start position = integer/%i_variable%, number of characters to extract from start position = integer/%i_variable%)\\ $between(input string = "string/%variable%", from string = "string/%variable%", to string = "string/%variable%"[, instance found= integer/%i_variable%])\\ {{:functions:middle-between.jpg?nolink&800|}} ------ ===== $upper vs $lower and $proper ===== *$upper : Force string to upper case. *$lower : Force string to lower case. *$proper: Capitalizes every first letter following a non-alphanumeric character. Usages:\\ $upper(input string = "string/%variable%")\\ $lower(input string = "string/%variable%")\\ $proper(input string = "string/%variable%")\\ {{:functions:lower-upper-proper.jpg?nolink&800|}} ----- ===== $replace and $alrep ===== *$replace : Replace string in string. If "type" is set to 1 then the string to replace are split into characters. *$alrep : Replace all non-alphanumeric characters and add optional exceptions. Usage:\\ $replace(input string = "string/%variable%", string to replace = "string/%variable%" [, replace with string = "string/%variable%", type = 0])\\ $alrep(input string = "string/%variable%"[, replace with string = "string/%variable%"][, except characters = "string/%variable%"])\\ {{:functions:replace.jpg?nolink&800|}} {{:functions:alrep.jpg?nolink&800|}} ----- ===== $regreplace ===== *$regreplace : Replace string in string by regex pattern. Usage:\\ $regreplace(input string ="string/%variable%", string to replace ="string/%variable%" [, replace with string ="string/%variable%") {{:functions:regreplace.png?nolink&800|}} ------------- ===== $leads vs $trails ===== *$leads : Add leading character(s) to a string. If string to fill is omitted a zero (0) will be used. *$trails : Add trailing character(s) to a string. If fill-string is omitted a zero (0) will be used. Usage:\\ $leads(input string = "string/%variable%", total number of output characters = integer/%i_variable%[, string to fill = "string/%variable%"])\\ $trails(input string = "string/%variable%", total number of output characters = integer/%i_variable% [, string to fill = "string/%variable%"])\\ {{:functions:leads-trails.jpg?nolink&800|}} -------- ===== $stripws and $stripcrlf ===== *$stripws : Removes leading and trailing white spaces. *$stripcrlf : Removes carriage returns and line feeds from string. Usage:\\ $stripws(input string = "string/%variable%")\\ $stripcrlf(input string = "string/%variable%")\\ {{:functions:stripws-stripcrif.jpg?nolink&800|}} ------ ===== $isdigit and $isalpha ===== *$isdigit : Check if string is only numbers. Success returns 1, failure returns 0. *$isalpha : Check if string is only alphabetic letters. Success returns 1, failure returns 0. Usage:\\ $isdigit(input string = "string/%variable%")\\ $isalpha(input string = "string/%variable%")\\ {{:functions:isdigit-isalpha.jpg?nolink&800|}} ------- ===== $length and $reverse ===== *$length : List the number of characters. *$reverse : Reverse a string. Usage:\\ $length(input string = "string/%variable%")\\ $reverse(input string = "string/%variable%")\\ {{:functions:length-reverse.jpg?nolink&800}} ------- ===== Nested Functions ===== All functions can be nested (functions within functions). __Example 1__: $replace($left("my strings", 6), "my", "your") {{:functions:FFAStrans_compute.jpg?nolink&50|}} your str __Example 2__: $upper($triml($trimr("function number 131 is useful", 10), 9)) {{:functions:FFAStrans_compute.jpg?nolink&50|}} NUMBER 131 ------------------------------------------                                                                                                           [[functions:character_string_functions|Back to top]]