Lists

What are lists?

Lists = Arrays

An array is a container object that holds a number of values of a single type. Each item in an array is called an element, and each element is accessed by its numerical index. As shown in the preceding illustration, numbering begins with 1 (in normal codes it starts with 0).

Lists are used mainly for splitting and managing a text

Creating a list

You can make a list by splitting a text seen as example bellow, Creating an empty list or Making a list with same items by x times.

Output
[ 'A', 'B', 'CD', 'E', 'FG', 'H' ]
// 1    2     3    4     5    6 (POSITIONS)

Managing a list

Output
[ 'Z', 'B',  'CD', 'E', 'FG', 'H', 'X' ]
/* Changed FIRST position to "Z", push = add to last position "X"*/

Information of a list

Output
6 //lenght
true // list contains "A"
1 //First position of Item "A"
CD //get item number 3
E,FG,H //get sub-list from 4 to last

RegEx

A regular expression is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation.

To make a Regex, you can use https://regex101.com/

Output
['def']
/*This RegEx will get everything that is inside of brackets [], for multiple brackets
it will be as the next output in a list ['def', 'etc']

How to RegEx

  1. You set OUTPUT to variable to be able to use it later, you can save "Create new RegEx of" to variable too to use it multiple times.

  2. Now you have output you can do whatever you want.

  3. Length of matches = how many matches exists on given text, output is in lists

Last updated