textTrim(value: Text) (result: Text) { result = text.trim(value) } textLower(value: Text) (result: Text) { result = text.lower(value) } textUpper(value: Text) (result: Text) { result = text.upper(value) } textCodepoint(value: Text) (result: Int?) { result = text.codepoint(value) } textFromCodepoint(value: Int) (result: Text?) { result = text.fromCodepoint(value) } textAt(value: Text, index: Int) (result: Text?) { result = text.at(value, index) } textSlice(value: Text, start: Int, end: Int) (result: Text?) { result = text.slice(value, start, end) } textIndexOf(value: Text, pattern: Text) (result: Int?) { result = text.indexOf(value, pattern) } textContains(value: Text, pattern: Text) (result: Bool) { result = text.contains(value, pattern) } textStartsWith(value: Text, prefix: Text) (result: Bool) { result = text.startsWith(value, prefix) } textEndsWith(value: Text, suffix: Text) (result: Bool) { result = text.endsWith(value, suffix) } textSplit(value: Text, separator: Text) (result: List) { result = text.split(value, separator) } textReplace(value: Text, pattern: Text, replacement: Text) (result: Text) { result = text.replace(value, pattern, replacement) } textIsEmpty(value: Text) (result: Bool) { result = text.isEmpty(value) } textJoin(values: List, separator: Text) (result: Text) { result = text.join(values, separator) } intParse(value: Text) (result: Int?) { result = int.parse(value) } intToText(value: Int) (result: Text) { result = int.toText(value) } floatFromInt(value: Int) (result: Float) { result = float.fromInt(value) } floatParse(value: Text) (result: Float?) { result = float.parse(value) } floatToText(value: Float) (result: Text) { result = float.toText(value) } decimalRound(value: Decimal, places: Int) (result: Decimal) { result = decimal.round(value, places) } decimalParse(value: Text) (result: Decimal?) { result = decimal.parse(value) } decimalToText(value: Decimal) (result: Text) { result = decimal.toText(value) } decimalFromInt(value: Int) (result: Decimal) { result = decimal.fromInt(value) } mathSqrt(value: Float) (result: Float) { result = math.sqrt(value) } mathSin(value: Float) (result: Float) { result = math.sin(value) } mathCos(value: Float) (result: Float) { result = math.cos(value) } mathLog(value: Float) (result: Float) { result = math.log(value) } mathPow(value: Float, exponent: Float) (result: Float) { result = math.pow(value, exponent) } mathIsNan(value: Float) (result: Bool) { result = math.isNan(value) } mathIsFinite(value: Float) (result: Bool) { result = math.isFinite(value) } mathIsInfinite(value: Float) (result: Bool) { result = math.isInfinite(value) } rule requiredFloat(value: Float?) (out: Float) | value | out | | null | fail(Invalid) | | other | value | rule requiredDecimal(value: Decimal?) (out: Decimal) | value | out | | null | fail(Invalid) | | other | value | readFloat(value: Text) (out: Float) { out = requiredFloat(float.parse(value)) } readDecimal(value: Text) (out: Decimal) { out = requiredDecimal(decimal.parse(value)) } appendChunk(chunk: Text, whole: Text) (out: Text) { out = whole + chunk } loop joinChunks(parts: List) (out: Text) | each chunk in parts | result | | out | fold(whole = "", appendChunk(chunk, whole)) | loop prefixChunks(parts: List) (out: Text) | each chunk in parts | result | | out | fold(whole = "前缀:", appendChunk(chunk, whole)) |