String Functions#
join
- Join Strings#
Join strings with optional separator.
import ison
dicData = {
"__locals__": {
"lA": ["a", "b", "c"]
},
"result 1": "$join{$lA}",
"result 2": "$join{$lA, `, `}",
}
dicResult = ison.run.Run(xData=dicData)
print(ison.run.ToString(dicResult))
{
"result 1": "abc",
"result 2": "a, b, c"
}
str
- Formatted String#
Creates a formatted string of a value.
import ison
dicData = {
"__locals__": {
"dicA": { "a": 1 }
},
"str{42, 04d}": "$str{42, 04d}",
"str{42, 04x}": "$str{42, 04x}",
"str{1.2345, 10.2f}": "$str{1.2345, 10.2f}",
"str{1.2345, 10.2e}": "$str{1.2345, 10.2e}",
"str{1.2345, 10.2g}": "$str{1.2345, 10.2g}",
"str{$dicA}": "$str{$dicA}"
}
dicResult = ison.run.Run(xData=dicData)
print(ison.run.ToString(dicResult))
{
"str{42, 04d}": "0042",
"str{42, 04x}": "002a",
"str{1.2345, 10.2f}": " 1.23",
"str{1.2345, 10.2e}": " 1.23e+00",
"str{1.2345, 10.2g}": " 1.2",
"str{a}": "{'a': 1}"
}