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:

Count

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:

Replace

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:

Trim

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:

Uppercase

data.ModifiedText = string.upper(data.BaseText)

We are learning from you!

Did you find this article helpful?

Be enlightened!

Do you need more support?

Peakboard Youtube icon Visit our YouTube channel

Our numerous videos for beginners and advanced users explain exactly how to design your dashboard.

Peakboard Templates icon Visit the Peakboard Templates

Download our templates for various use cases for free.

Peakboard icon Visit www.peakboard.com

Find out all about Peakboard and browse our different use cases and success stories.