Truncate

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with " This function is an Advanced Text function in the UBot Extended Library. This function cuts text at a specific location, replacing it with "...". '''Text to truncate...")
 

Latest revision as of 20:53, 10 July 2015

This function is an Advanced Text function in the UBot Extended Library.

This function cuts text at a specific location, replacing it with "...".


Text to truncate: The text being pruned.

Location: Position where sentence should stop.


Can be used with the Find Index function to quickly find the position of a word within the sentence for proper truncation.


[edit] Example

In this example, we want everything after the word "Start" to be truncated. First, we find the index of the first word after the word "Start", which is "small"

set(#indextext,$find index("Make an investment into yourself. Start small with a few hours of training and watch as your potential unfolds.","small"),"Global")

After the index is found, the variable the index is assigned to is placed in the truncate function in place of "Location".

alert($truncate("Make an investment into yourself. Start small with a few hours of training and watch as your potential unfolds.",#indextext))


The resulting text is shown below:


Trunctxt.jpg

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox