Maintenance

All wikis at Biowikifarm are in read-only mode due to the restoration after a severe cyberattack in October 2023.
After 1 year being shut down the Biowikifarm is online again.
You see the latest restored version from 18th October 2023.

Vorlage:If-Instring

Aus Bayernflora
Wechseln zu: Navigation, Suche

If parameter "searchterm" exists in parameter "string", then the parameter "then" is returned, else the parameter "else". If else is missing, an empty string is returned in the second case

USAGE:

={{If-Instring | searchterm = a | string = abc | then = found | else = not found}}= returns actually "=found=", expected: "=found="
={{If-Instring | searchterm = a | string = bcd | then = found | else = not found}}= returns actually "=not found=", expected: "=not found="

Note on the code: If the search term is found, the return value of #pos is a zero-based integer of the first position within the string (and #if is true). If the search term is not found, the function returns an empty string (and #if is false).