8577c06e473e9a888f83df214675ea3b1a4ede30 kent Tue Aug 13 18:51:01 2019 -0700 Implementing pick() operation, more or less the strex equivalent to switch. diff --git src/lib/strex.doc src/lib/strex.doc index ec07ed4..756729c 100644 --- src/lib/strex.doc +++ src/lib/strex.doc @@ -80,20 +80,27 @@ If old is "", then empty strings will be replaced by new strings, useful in setting a default value for a field. fix(string, target, newString) - similar to replace but works at the whole string level. Returns string unchanged except for the case where string matches target exactly. In that case it returns newString instead. The name "fix" comes from it being used generally to replace one constant, fixed, string with another. Also, a lot of the time when you do this it is to fix a small inconsistency in the metadata. In general fix is faster to execute and quicker to type than replace and the effects are more specific. example to help clean up minor variations in vocabulary fix(fix(fix(fix( sex, "M","male"), "F","female"), "Male","male") "Female","female") example to give something a value if non is present fix(requiredField, "", "reasonable default value") +pick(query, key1:val1, key2:val2, ... keyN:valN) + Looks through keys for one that matches query, and returns associated value if + it finds it. Otherwise returns empty string. + Can be used to apply different expressions to parsing in different conditions: + pick(species, "human" : ethnicity, "mouse" : strain ) + + md5(string) - returns an MD5 sum digest/hash of string. Useful for creating IDs out of large or merged fields. now() - returns current time and date in a really aweful unix ctime(2) format. We will improve it.