--- title: "Text Block" slug: "text-block" updated: 2021-08-06T14:05:12Z published: 2021-08-06T14:05:12Z canonical: "help.pillir.io/text-block" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.pillir.io/llms.txt > Use this file to discover all available pages before exploring further. # Text Block ### The Text blocks are as follows: It performs all operations with respect to texts. #### ## Text: The text block may have a text or number within quotations. This is used to represent a string. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Text or Number | Text | ![](https://lh5.googleusercontent.com/7413stLwDqtnF69_ua-EBP75zDAVAEArh0UKNrOAuUewTYKwx0h_zqNPeUiWRxETtRD-tb8P2-R_o6X8JBIXrAPlDvDqWsMAivDkfbPDMx25SrCOuDdok_taaTX8DugayMr-D6oP) | ```javascript '' ``` | #### ## Create Texts from Multiple Texts: This block combines two texts to return a new text. It is similar to string concatenation where two texts are joined to form a new text. It can be done using independent variables or Arrays. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or text or number for all | Text | ![](https://lh6.googleusercontent.com/K6rC6xXinBDwttpouUtwDWvDuRzsFEPXIB9BDgalmDayvmMbu_fVdiORP7C3z8nIBtGY7luMhSVuPEeOaEgwV57Cu3eLSaUeqzAIowza6NwJ2JM1pnhjpFeg81NnK47iCA5AGDad) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620902890579.png) | ```javascript '' + '' or ['','','',''].join(''); ``` | #### ## Text to Title Case or Lowercase or Uppercase: This block converts lowercase to uppercase letters and vice-versa. It applies to Strings. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or text Choose the type of text operations | Text | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620902938624.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620902954688.png) | ```javascript 'abc'.toUpperCase() 'abc'.toLowerCase() textToTitleCase('abc') ``` | #### ## Length: This block takes a particular text input (String) and provides the length of the text as output. The length is the integer. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Text | Length of Text as Number | ![](https://lh3.googleusercontent.com/86ovAtCAlhAuH_ho00pipaI9cb1U0q_an-KpHmIxqtyG0lwLwt4VomyUA7PDRQpXpd3eqvZg1fH3XCMcRiR7LXqvq7U60CeqT--fn2PaEs7EXWKBQACDYAIWh4R28pFUBEFNWg46) | ```javascript 'abc'.length ``` | #### ## Append Text: This block is used to append the text value to the declared variables. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable for input-1 dropdown, Variable or Text for an input-2 from left. | Append text value to the variable | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620902996857.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903014957.png) | ```javascript item += '' ``` | #### ## Search Text: This block is used to search and locate a particular text value from a given variable with the help of the text index. The search is done either on the top-down approach or vice-versa. By identifying the index value, the text location is identified and displayed in the output. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or Text for all choose the search type (first - from the top, last - from the bottom). | Returns the index of the first occurrence of the given input-2 text to the input-1 variable or Text depends on choice. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903108858.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903124723.png) | ```javascript text.indexOf('abc') + 1 text.lastIndexOf('abc') + 1 ``` | #### ## Get Char: This block fetches a particular character or letter (first letter/last letter/random letter) for a string input. Similar to the "search text" option, this is also done with the help of indexing. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or Text for input-1 Variable or number for input-2 from left Choose the search index type (# - index from the top, # from end - index from the bottom, first letter, last letter and random letter). | Returns character from given input-1 text for given input-2 index. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903143934.png) | ```javascript text.charAt(0) text.slice(-1).charAt(0) text.charAt(0) text.slice(-1) textRandomLetter(text) ``` | #### ## Print: This block is used to print a particular text that is given as a variable input. The input can either be a text or a number declared as a string. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or Text or Number | Print the value to the popup window. | ![](https://lh4.googleusercontent.com/oSwLB5Rm_9ADuVIm-prRtc1vDzUVVftY40HGmASc8HTH0tC-H4_TUsGm9oW5icj53YowFmpoMSNm8sXWwZmjYG-eSxWCw6DHLgmLRfIy7Io-GsdO5hRQPH30b4dIY7Mq65uYI2h7) | ```javascript window.alert('Text'); ``` | #### ## Print to Console: This block is used to print a particular variable to console log. The variable can be either a text or a number declared as a string. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or Text or Number | Print the value to console output. | ![](https://lh5.googleusercontent.com/k3Fn0YgEIuHL2aycoC4o2eUTmax4Py4nsjOz74KSXwzPGj6RjgxlA7n1Jb9W2RGWgrZtTqmZlYEewpfQFq06tQIaCMTwsCAORFgsdictDVZZU8SwOwBun_ILBuaW_q5wpozlQV3E) | ```javascript console.log(''); ``` | #### ## Trim: This block helps to identify the number of white spaces in between texts, after and before texts. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or Text, choose the trim type (both sides - trim both sides white space, left side - trim only left side white space and right side trim only right side white space). | Returns white space trimmed Text depends on choice. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903270335.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903289198.png) | ```javascript 'abc'.trim() 'abc'.replace(/^[\s\xa0]+/, '') 'abc'.replace(/[\s\xa0]+$/, '') ``` | #### ## Variable Functions: The variable functions are nothing but commands that return values based on user requests. They return: character location, character code location, concatenated values, includes, index values, last index values, and local comparison values. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or Text or number for all Choose the type of function | Returns Text or Character depends on choice. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903323399.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903349058.png) | ```javascript pillirFunctions. variable_function("charAt", "", "", "") ``` | #### ## Subtext: This block is used to identify a particular text from a group of texts. The inputs are given and the output is a character based on all the inputs. | **Input** | **Output** | **Block Layout** | **Generated Code** | | --- | --- | --- | --- | | Variable or Text for input-1 Variable or number for input-2 and 3 | Returns the Text from input-1 depends upon input-2 and 3. | ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903402424.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903459413.png) ![](https://cdn.document360.io/718af901-247b-46be-8ace-83da21839237/Images/Documentation/image-1620903481429.png) | ```javascript text.slice(0, 1) ``` |