Skip to content

Custom separator characters

Nick Korotysh edited this page Feb 29, 2024 · 3 revisions

Time format string recognizes only ":" (colon) as separator ("dots"), so when font is used instead of skin, it will be displayed as is. But what if you want something else instead, for example just a simple "." (period) or maybe some nice-looking Unicode character? Of course, you can put this desired character into format string instead of ":" and it will be displayed, but it will not flash, just because it is not recognized as separator (only separators can flash).

Fortunately, there is a special option for this case: all ":" in format string can be mapped to any other characters. The same number of replacement characters as the number of ":" should be provided. Replacement characters are used in the same order as ":" in format string, i.e. the first character will be used instead of the first ":" and so on. Example is below.

For example, format string looks like "hh:mm:ss", what means "12h time format, hours with leading zero (e.g. "08"), minutes with leading zero, seconds with leading zero. It may produce something like this: "01:45:36", but you want, for example, "01*45|36". So, to get desired result, "*|" should be provided as replacement characters ("*" instead of the first ":", "|" instead of second ":"), the order is important. In that case, both "*" and "|" become separators, hence they can flash!

There is no restriction on what can be used as replacement character, but it should be a single character. Less number of replacement characters than ":" count in format string is allowed too, but in this case only the first few ":" will be replaced, the rest will still be ":". For example, for the format string above, only "*" was provided as replacement character, so the result string will be "01*45:36" (note ":" at the second place).

Clone this wiki locally