Wikifunctions:Catalogue
This is a guided list of example Functions provided. See also the complete list of functions and Wikifunctions:Suggest a function.
Logic operators
These are the fundamental tools to control flow in your functions.
- If (Z802): depending on whether the condition is true will return one or the other value
Basic Boolean operations
These are the basic blocks from which to build logic states.
- not (Z10216): takes a truth value and returns its opposite
- and (Z10174): Performs a Boolean and operation
- or (Z10184): Performs a Boolean OR operation
- Boolean equality (Z844): returns true only if both inputs are equal
- Boolean inequality (Z10237): returns true only if both inputs are different
Boolean pairwise functions
# | Name | ZID | Value |
---|---|---|---|
1 | nullary false | nullary false (Z10206) | F |
2 | nullary true | nullary true (Z10210) | T |
# | Name | ZID | F | T |
---|---|---|---|---|
1 | unary false | unary false (Z10214) | F | F |
2 | identity | identity (Z10215) | F | T |
3 | not | not (Z10216) | T | F |
4 | unary true | unary true (Z10217) | T | T |
# | Name | ZID | F#F | F#T | T#F | T#T |
---|---|---|---|---|---|---|
1 | binary false | binary false (Z10257) | F | F | F | F |
2 | and | and (Z10174) | F | F | F | T |
3 | not (A->B) | not boolean implication (Z10962) | F | F | T | F |
4 | A | Boolean Left (Z10265) | F | F | T | T |
5 | not (B->A) | not backwards Boolean implication (Z10964) | F | T | F | F |
6 | B | Boolean Right (Z10298) | F | T | F | T |
7 | xor | Boolean inequality (Z10237) | F | T | T | F |
8 | or | or (Z10184) | F | T | T | T |
9 | nor | nor (Z10231) | T | F | F | F |
10 | xnor/eqv | Boolean equality (Z844) | T | F | F | T |
11 | not B | Boolean Not Right (Z10306) | T | F | T | F |
12 | B->A | backwards Boolean implication (Z10348) | T | F | T | T |
13 | not A | Boolean Not Left (Z10272) | T | T | F | F |
14 | A->B | Boolean implication (Z10329) | T | T | F | T |
15 | nand | nand (Z10243) | T | T | T | F |
16 | binary true | Binary True (Z10287) | T | T | T | T |
String operations
String evaluation operations
These functions perform simple tests on a text string to tell you if something else needs to be done, or they already are in an expected format.
- string equality (Z866): True if the first string and the second string are the same
- case-insensitive string equality (Z10539): returns true if both strings are the same if converted to lowercase
- substring exists (Z10070): Check if a substring exists within another string
- string starts with (Z10615): true if the substring exists at the beginning of the string
- string ends with (Z10618): true if the substring exists at the end of the string
- is empty string (Z10008): true if the input string is empty
- is string blank (Z10083): Checks if a string just contains whitespaces
- is numeric (Z10715): Checks if a string contains only numeric characters
- is uppercase (Z10336): checks if string is all uppercase
- is lowercase (Z10346): checks if string is all lowercase
- is title case (Z10375): checks if string is in title case
- is pascal case (Z10363): checks if string is in pascal case
- is camel case (Z10897): true if the entered string is in camel case (e.g. 'camelCase')
- is snake case (Z10324): checks if string is in snake case
- is anagram (simple) (Z10973): Test if the same characters at the same number of times are used in two strings (characters must be exact code points).
- fallback if string is empty (Z11082): returns a fallback string if the value is empty, and the value itself if not
Simple String transformations
These perform character replacements and other basic operations.
- join strings (Z10000): combine two strings, one after the other
- reverse string (Z10012): Inverts the order of the characters in a String (see Z10548 for one with Unicode grapheme support)
- To Uppercase (Z10018): Convert a string to uppercase letters
- To Lowercase (Z10047): Convert a string to lowercase letters
- Replace All (Z10075): finds and replaces all instances of a substring in an input string
- Remove Spaces (Z10052): Remove all spaces from a string
- Trim String (Z10079): Remove starting and ending whitespaces
- wrap string (Z11145): add wrapper text to the start and end of a string
- unwrap string (Z11151): removes text from start and end of string once only if both are present
- remove all characters except ASCII digits, uppercase Latin letters and lowercase Latin letters (Z10171): 文字列から半角英数字以外の文字を除去する
- normalize Unicode (Z10612): Makes the Unicode normalization of the strings
- duplicate string (Z10753): takes a string and returns it duplicated
- Replace all (regex) (Z10193): Replace characters in a string with another string according to a regex pattern
- To Titlecase (Z10251): Converts a string to title case
- To Pascal Case (Z10290): convert string to Pascal Case
- to camelCase (Z10816): convert string to lower camelCase,
- To Snake Case (Z10281): convert string to snake case
- string to hex (UTF-8) (Z10366): convert string of UTF-8 characters into hexadecimal
- hex to string (UTF-8) (Z10373): המרת הקס←מחרוזת (UTF-8)
- URI percent encode (Z10761): encodes certain characters using URI percent encoding syntax
- URI percent decode (Z10774): Decodes a percent-encoded input string
- international morse code encode (Z10944): Encodes the supplied string in morse code, separating letter encodings by spaces and words by " / "
- international morse code decode (Z10956): Decodes the supplied string in morse code: separate letter encodings by spaces and words by " / "
- Encode NATO phonetic alphabet code (Z10309): Requires ALLCAPS input, e.g. EXAMPLE
- Decode NATO phonetic alphabet code (Z10970): case insensitive
- get first character of string (Z10901): returns the first character of a string
- remove interpunction characters (Z11193): Removes all interpunction characters
Uncommon String operations
These functions perform more advanced transformations, hold more states and showcase the more advanced capabilities of Wikifunctions.
String classical cipher functions
(alphabet needs to be specified when calling these functions)
- ROT1 (Z10846): move by one letter in the English alphabet
- ROT25 (Z10851): move each letter one letter back in the English alphabet
- ROT13 (Z10627): Encode/Decode a string with ROT13 cipher ROT13 encrypt/decrypt
Cryptographic hash functions
(would be better with types representing a stream of bytes)
- is palindrome (Z10096): test if a string is the same when read forward and backward (see Z10553 for one with Unicode grapheme support)
- SHA-256 (Z10124): Returns the hexadecimal hash of a string in SHA-256 SHA-256
- SHA-384 (Z10132): 入力された文字列のSHA-384ハッシュ値を計算する SHA-384
- SHA-1 (Z10148): SHA-1 hash of the UTF-8 representation of a string, as a lowercase hexadecimal byte string SHA-1
- SHA-512 (Z10067): Hash a string using the SHA-512 function SHA-512
Experimental String operations
TODO: Explain why these exist and when people might use them.
- (!) get lemma string from Lexeme JSON (Z10037): (!) approximates mw.wikibase.lexeme.entity.lexeme:getLemma(languageCode)
- Turkish final-obstruent devoicing for string (Z10022): トルコ語の文字列において、末尾の有声阻害音を無声化した綴りを返す
- Base64 Decode (Z10062): Decode a string from base64
Natural language String operations
Esperanto String operations
- is Esperanto adjective (Z10450): checks if word is an Esperanto adjective
- is Esperanto adverb (Z10491): checks if word is an Esperanto adverb
- is Esperanto noun (Z10514): checks if word is an Esperanto noun
- to h-system (Z10458): transliterates Esperanto's circumflex letters to Latin alphabet
- to x-system (Z10459): transliterates Esperanto's circumflex letters to Latin alphabet
- from x-system (Z10574): transliterates Esperanto's x-system to the proper Esperanto alphabet
- from h-system (Z10953): transliterates Esperanto's h-system to the proper Esperanto alphabet
- Esperanto plural (Z10482): writes this word in the plural form for Esperanto
Japanese String operations
- is hiragana (Z10878): Given a character, returns boolean for whether it is an hiragana or not.
- is katakana (Z10883): Given a character, returns boolean for whether it is a katakana or not.
- is kanji (Z10927): Given a character, returns boolean for whether it is a kanji or not.
Finnish String operations
- Finnish nominative plural (Z11205): Input Finnish nominative singular. Output Finnish nominative plural.
English string operations
- English plural (Z11089): Return the plural of an English word. See https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2023-09-08 for context.
Wikitext string operations
- csv record to wikitable row (Z10919): Converts a validly formatted (RFC 4180) comma-separated value series into the contents of a valid wikitable row (not including the row start or row end characters) where variables are separated by '||', and any whitespace is unchanged. Be careful to validly render CSV with quoted fields and with pipes ('|') in the field.
- wrap with XML tag (Z11156): adds <tag> and </tag> around a string
Comma-separated operations
- string is element of CSV (Z11094): Test whether a string is an element of a validly formatted (RFC 4180) comma-separated value series (single row, not whole file). Be careful to validly interpret a CSV with quoted fields.
Number operations
- number is between (Z10603): Returns true if a number is between a minimum and a maximum (inclusive of the endpoints)
Randomness
- random integer in range (Z10599): Generates a random integer between a minimum and maximum (Takes strings while no number type)
- choose from comma-separated list (Z10601): Returns a random item in a comma-separated list
Date operations
- is leap year (Gregorian calendar) (Z10996): Returns True if the specified year in the Gregorian calendar (the one currently used in most parts of the world) has 366 days (February 29th added), and False if the year has 365 days
- is leap year (Julian calendar) (Z11015): Returns True if the specified year in the Julian calendar has 366 days, and False if the year has 365 days
- is leap year (Jalali calendar) (Z11011): Returns True if the specified year in the Jalali calendar (one of the calendars still in use in Iran and Afghanistan, also called Persian calendar) has 366 days, and False if the year has 365 days
See also
- There is an automatic, un-guided list of functions on the Special page for all objects of type Function (Z8)
- External function lists: