Scripting
Processing Text
With Peakboard, you can not only display and evaluate texts and strings but also manipulate them. Here are some examples and guidelines on how to work with texts.
Evaluating Text
One way to evaluate text is by counting the characters. You can use the following code for this:
data.ModifiedText = string.tostring(string.len(data.BaseText))
Manipulating Text
Possible manipulations include replacing, trimming, deleting, and adjusting the case.
Replacing
To replace specific parts of a text, use the following code:
data.ModifiedText = string.replace(data.BaseText, 'like', 'love')
Trimming
To trim the text, i.e., display only a specific part of the text, use this code:
data.ModifiedText = string.sub(data.BaseText, 1, 7)
Deleting
To delete non-numeric characters from the text, use:
data.ModifiedText = string.match(data.BaseText, "%D+")
Uppercase
To convert the entire text to uppercase, use:
data.ModifiedText = string.upper(data.BaseText)