Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


tips:textshortening

Shorten Long Text

Examples

Limit event text to 18 characters

 string.sub('{c1t}', 1, 18)

Show ellipses after shortened event text

 string.format('%-.18s%s',string.sub('{c1t}', 1, 15), string.len('{c1t}')>18 and '...' or string.sub('{c1t}',16,18))

Show event time with shortened event text and ellipses when needed

 string.format('%s %-.18s%s', '{c1b}', string.sub('{c1t}', 1, 15), string.len('{c1t}')>18 and '...' or string.sub('{c1t}',16,18))

Intro

If you display three event text on your watch face, you may find times when the text is just too long.

You could handle this problem by editing the event in your calendar, or simply ignoring it. After all, it will go away in a few hours. With a little code, you can instead be prepared for this inevitability.

The examples on this page use string functions in LUA to limit the length of the event text. If you want to use the examples as is, you can copy them into the text field where you display the event text.

Explanation of Examples

(Coming Soon)

tips/textshortening.txt · Last modified: 2015/01/24 06:36 by rahul_pawa