[FREE] StringFunctions Extension

Version - 2
Release date - 25 January, 2021
Last updated - 3 February, 2021

Write a short description

This is my first extension! This extension provides various methods to help you work with strings. It has 21 blocks. Some of the function names are real functions in the Python programming language (but in lowercase). You can learn these python functions by using these blocks :stuck_out_tongue_winking_eye:

Add a picture of all the blocks

Documentation

blocks (18)

ErrorOccurred
It is called whenever an error occurs. Use the error variable to know what the error is.


blocks (57)

AllIndex
Returns the index of all the occurrences of a string - piece in another string - text.
Example: text = Good morning everyone, hello everyone? | piece = everyone returns [14, 30].


blocks (15)

Capitalize
Capitalizes the first letter of a string - text.
Example: text = hello, how are you? returns Hello, how are you?.


blocks (65)

ChangeCase
Changes the case of a string - ‘text’ according to the case given - ‘toCase’.
The valid cases are - upper case, lower case, sentence case, title case and toggle case.
If you enter a wrong case, an error will occur.
Example:

  • text = hello everybody | toCase = upper case returns HELLO EVERYBODY.
  • text = HELLO EVERYBODY | toCase = lower case returns hello everybody.
  • text = hello everybody. how are you? | toCase = sentence case returns Hello everybody. How are you?.
  • text = hello everybody | toCase = title case returns Hello Everybody.
  • text = hello everybody | toCase = toggle case returns randomly capitalized and lowered string like heLlO EveRyboDY.

blocks (16)

Count
Counts the number of occurrences of a string - piece in another string - text.
Example: text = I like mangoes, do you like mangoes? | piece = mangoes returns 2.


blocks (19)

EndsWith
Tells whether a string - text ends with another string - piece.
Example: text = I know how to code! | piece = code! returns true.


blocks (20)

Index
Returns the index of the first occurrence of a string - piece in another string - text.
Example: text = Good morning everyone, hello everyone? | piece = everyone returns 14.


blocks (21)

IsAlpha
Tells whether a string - text consists of only letters.
Example: text = 1, 2, 3 are numbers returns false.


blocks (22)

IsAlphaNumeric
Tells whether a string - text consists of only letters and numbers.
Example: text = Hello, 1 is the best! returns false.


blocks (23)

IsDigit
Tells whether a string - text consists of only numbers.
Example: text = 123 returns true.


blocks (24)

IsLower
Tells whether a string - text is all lowercase.
Example: text =hello returns true.


blocks (25)

IsTitle
Tells whether a string - text is in the form of a title (Only the first letter of every word capitalized).
Example: text = The Book Of Light returns true.


blocks (26)

IsUpper
Tells whether a string - text is all uppercase.
Example: text = HELLO returns true.


blocks (27)

Join
Joins a list of strings - texts with a string - joiner.
Example: texst = [hello, how, are, you] | joiner = a returns helloahowaareayou.


blocks (28)

LStrip
Removes spaces from the left of a string - text.
Example: text = "          Hello!" returns Hello!.


blocks (30)

Partition
Breaks a string - text into three parts at the first occurrence of a string - piece and returns a list of the three parts. The three parts are the text before the piece, the piece and the text after the piece
Example: text = We all should eat fruits as they are healthy | piece = fruits returns [We all should eat , fruits, as they are healthy].


blocks (31)

RIndex
Returns the index of the last occurrence of a string - piece in another string - text.
Example: text = Good morning everyone, hello everyone? | piece = everyone returns 30.


blocks (32)

RPartition
Breaks a string - text into three parts at the last occurrence of a string - piece and returns a list of the three parts. The three parts are the text before the piece, the piece and the text after the piece
Example: text = We all should eat healthy fruits and healthy vegetables | piece = healthy returns [We all should eat healthy fruits and , healthy, vegetables].


blocks (33)

RStrip
Removes spaces from the right of a string - text.
Example: text = "Hello!       " returns Hello!.


blocks (34)

Title
Converts a string - text into the title form (Only the first letter of every word capiatlized).
Example: text = the book of light returns The Book Of Light.


blocks (63)

Substrings
Returns a list of all the sub-strings of a string - text of a specific length - length.
Example: text = banana | length = 2 returns [ba, an, na, an, na].


Some extra info

All indexes start from 1.
Every method returns error if an error occurs.

Download link

Direct Download - com.sumanyu.StringFunctions.aix (28.9 KB)

Thanks to everybody who helped me in the community with my questions!

I hope you like this extension, if so please leave a like!
If you have any suggestions, do tell me!

29 Likes

great @Pythony

Thank you!

1 Like

Good Extension @Pythony

1 Like

Congratulations On Your First Extension… :tada: :tada: :tada: :confetti_ball: :confetti_ball:

1 Like

Thank you! @oseamiya and @Akshat_Rana

2 Likes

For some reason, this code does not work. When selecting from 1 to 10, label text = “NO”

2 Likes

The is digit function returns a boolean true or false.
So if text box text is a number your code will be comparing true with the random number which will be false.
So you should first check whether the number IsDigit and then check whether it is equal.

2 Likes

Nice extension: keep it up.

1 Like

Thank you!

1 Like

Can you add a block to remove specific text? Like trimming a word or number.

Example
Original Text: 1234 ABCD
Result: 134ACD

So you mean that remove a string from another string?

My Mind is out of control when seeing this useful extension. Nice creation.

You can already create it in Kodular
Blocks.png

Thank you!

Great job! The documentation looks well :+1: Maybe try something new that cannot or hard to achieve with default blocks :wink:

To remove a specific text from a string.

Achievable using replace text block! Follow this by @Raja_HarshVardhanSolanki

Thank you!

Yes, I have added those blocks which are not in the default blocks. Any other blocks which you think I can put?

1 Like