You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pEpJNIAdapter/src/codegen/textutils.ysl2

36 lines
754 B
Plaintext

function "UCASE" {
param "text";
value "translate($text, 'abcdefghijklmnopqrstuvwxyz-', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_')";
}
function "lcase" {
param "text";
value "translate($text, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ-', 'abcdefghijklmnopqrstuvwxyz_')";
}
function "hyphenize" {
param "text";
value "translate($text, '_', '-')";
}
function "CamelCase" {
param "text";
const "tokens", "str:tokenize($text, '-')";
for "$tokens" {
choose {
when ".='pEp'" > pEp
otherwise {
call "UCASE" with "text", "substring(., 1, 1)";
value "substring(., 2)";
}
}
}
}
define operator "©([$@]?[a-zA-Z0-9_]+)" as call "CamelCase" with "text", "%1";