String

TEA Manual
Prev | Chapter 9. Functions | Next

# 9.16. String

Split by the delimeter - actually, this function replaces all delimeters in a text with the new line character. Set the delimeter value in the Famous text entry.

Split after the delimeter - adds the line line character after the each delimeter found in a text. Set the delimeter value in the Famous text entry.

CSV-like table to LaTeX table - use this function if you want to convert a CSV-like table into the LaTeX table format. How it works?

Open the OpenOffice.org Calc or Gnumeric, and save your table sheet as a CSV-file. It is a simple text file where cells are separated with some delimiting character (separator), usually comma (comma-separated file). But if you have commas in cells, use another character as a delimiter. If Gnumeric you should use Save as - Export as text files where you can define the separator.

Then open your CSV-file in TEA. Select the text. Use CSV-like table to LaTeX table. Voila!

Split to TeX paragraphs - splits the text to TeX paragraphs, adding empty lines between strings. To convert your plain text into TeX, your first step should be use of this function.

Convert usual quotes to TeX quotes - yes it is. Just a one note - it process double-quotes only.

Escape and quote/Unescape and unquote - you know, all that coders stuff, when you need escape/unescape some string or a filename full of that damned whitespaces.

Numerate lines - numerates selected lines. Define the format of numeration in the famous text entry. The format is a weird one: printf-like format string~step of the counter~initial value of the counter. The two last parameters are optional and equal to 1 by default. Let's imagine that you have a list of music bands:

Nirvana
Scorn
Napalm Death
Defecation
Neck
JR Ewing
Fall
Meathook Seed
The Doors
Led Zeppelin

Now you want to add a numbering to that list, and in the custom format. So, TEA can do it for you. You write the format string into the FAMOUS text entry. The format string is a very printf-like, i.e. you can use two macros - %d for a counter and %s for a string. To be more clear - %d represents the counter, and %s represents a string.

Here is some examples of format-string:

%d.)%s
%d.)%s~10
%d.)%s~10~4

The second line represents a format-string with a step parameter. Ten is the step value. 3-rd line is the format-string with the step and with the initial value of the counter. It is equal to 4.

You can also use %d after %s, i.e. %s (%d) give us a result:

Nirvana (1)
Scorn (2)
Napalm Death (3)
Defecation (4)
Neck (5)
JR Ewing (6)
Fall (7)
Meathook Seed (8)
The Doors (9)
Led Zeppelin (10)

Convert tabs to spaces - be sure to enter the tab size into the Famous text entry before. The value of a tab-size is the number of characters per a one tab.

Convert spaces to tabs - and now the Famous text entry content = how many spaces to find for replace each of them to the tab.

Reverse - reverse a text. For example, was roxton, will be notxor.

Antispam e-mail - makes a selected mailto-link possibly invisible to that damned spammer e-mail harvesters, by converting an address into integer-coded entities. For example, if you will look at the source of that document, so this link will look like a heap of garbage. I hope that spam harvesters do not understands it. I took an idea from a some issue of LinuxGazette.

Remove blank lines - removes blank lines form selected text. I do not think that it is a needful thing, but... Maybe it will be useful to someone.

Remove duplicates - removes duplicated lines.

Apply a template to each line - and again we use the Famous text entry. For example, I want to add br-tag at the end of each line of the selected text. So I type into the entry:

%s<br>

And then I apply that function and get br-tag added to the end of each line. In another case, I want to enclose an each line into a pair of li-tags. I type:

<li>%s</li>

Then I apply the function. So, as you understand, the %s macro = text of the line. And another example:

<a href="%s">%s</a>

Prev | Home | Next
Numbers | Up | Sort