Skip to content

Latest commit

 

History

History
82 lines (59 loc) · 1.33 KB

09_string.md

File metadata and controls

82 lines (59 loc) · 1.33 KB

Module string

This module has some functions for working with strings.

concat

This function concats two strings.

import @string

println(string.concat('pashm', 'ak')) # pashmak

remove_last

This function removes last character of a string.

println(string.remove_last('pashmak')) # pashma

remove_first

This function removes first character of a string.

println(string.remove_first('pashmak')) # ashmak

add_last

This function adds a string to last of other string.

println(string.add_last('pashma', 'k'))

add_first

This function adds a string to first of other string.

println(string.add_first('ashmak', 'p'))

length

This function returns length of a string.

println(string.length('pashmak')) # 7

cut

This function cuts a part of string.

println(string.cut('pashmak', 1, 4)) # ash

upcase

This function makes upper case string.

println(string.upcase('pashmak')) # PASHMAK

lowcase

This function makes lower case string.

println(string.lowcase('PASHMAK')) # pashmak

reverse

This function reverses a string.

println(string.reverse('pashmak'))

to_str

This function converts any type to string.

println(string.to_str(100))
println(typeof(string.to_str(100))) # test