Ring/Lessons/Strings

Strings
In this chapter we are going to learn about strings creation and manipulation.

String Literals
Syntax:

Get String Length
We can get the string length (letters count inside a string) using the len function

Syntax:

Example:

Convert Letters Case
Syntax:

Example:

Access String Letters
We can access a letter inside a string by the letter index

Syntax:

Example:

We can use for in to get string letters.

Example:

We can modify the string letters

Example:

Left Function
We can get a specified number of characters from a string using the Left function.

The starting position is 1.

Syntax:

Example:

Right Function
We can get a specified number of characters from a string using the Right function.

The starting position is the last character on the right.

Syntax:

Example:

Trim Function
We can remove all leading and trailing spaces from a string using the Trim function.

Syntax:

Example:

Copy Function
We can duplicate a string more than one time using the copy function.

Syntax:

Example

Lines Function
We can count the number of lines inside a string using the Lines function.

Syntax:

Example:

Substr Function
We can work on sub strings inside a string using the substr function. Using Substr we can


 * Find substring


 * Get substring from position to end


 * Get Number of characters from position


 * Transform Substring To Another Substring

Find substring
Syntax:

Example:

Get substring from position to end
Syntax:

Example:

Get Number of Characters From Position
Syntax:

Example:

Transform Substring To Another Substring
Syntax:

Example:

strcmp Function
We can compare between two strings using the strcmp function.

Syntax:

Example:

Output:

str2list and list2str Functions
We can convert string lines to list items using the str2list function. Also we can convert the list to a string using list2str function.

Syntax:

Example: