Text Block
  • 06 Aug 2021
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Text Block

  • Dark
    Light
  • PDF

Article summary

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

''


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



'' + ''

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

'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

'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


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.

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.



text.charAt(0)

text.slice(-1).charAt(0)

text.charAt(0)

text.slice(-1)

textRandomLetter(text)


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.

window.alert('Text');


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.


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.


'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.


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.



text.slice(0, 1)


Was this article helpful?

What's Next
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence