strings
color(string, colorCode)
- Changes the color of a string.
Parameters
string(string): The string that needs to be colored.colorCode(string): The color code.blueyellowblackgreygraywhitegreenredff00ff: Color codes like these are also compatible.
Return
- (string): The colored string.
Example
print(color("This is red", "red"))print("This is blue".color("blue"))Result:
This is redThis is blueThis would ofcourse be in blue and in red.
mark(string, colorCode)
- Marks a string.
Parameters
string(string): The string that needs to be marked.colorCode(string): The color code.blueyellowblackgreygraywhitegreenredff00ff: Color codes like these are also compatible.
Return
- (string): The marked string.
Example
print(mark("This is red", "red"))print("This is blue".mark("blue"))Result:
This is redThis is blueThis would ofcourse be marked in blue and in red.
bold(string)
- Turns a string into a bold string.
Parameters
string(string): The string that needs to be bold.
Return
- (string): The bold string.
Example
print(bold("This string is now bold"))print("This string is now bold".bold)Result:
This string is now boldThis string is now boldThis would ofcourse be bold.
underline(string)|ul(string)
- Adds an underline to a string.
Parameters
string(string): The string that needs to have an underline.
Return
- (string): The string with an underline.
Example
print(underline("This string now has an underline"))print("This string now has an underline".underline)Result:
This string now has an underlineThis string now has an underlineThis would ofcourse have an underline.
alpha(string, alphaCode)
- Changes the transparancy of a string.
Parameters
- string (string): The string that needs to be transparent.
- alphaCode (string): The transparacy code.
- aa: This is a valid transparacy code.
Return
- (string): A transparent string.
Example
print(alpha("This string is now transparant", "aa"))print("This string is now transparant".alpha("aa"))Result:
This string is now transparantThis string is now transparantThis would ofcourse be transparent.
startswith(string, prefix)
- Returns 1 if the string starts with the defined prefix else returns 0.
Parameters
string(string): The string that needs to be checked.prefix(string): The prefix that needs to be checked.
Return
- (number): 1 if the string starts with the prefix else 0.
Example
myString = "prefix is the start of this string"if myString.startswith("prefix") then print("The string starts with prefix")if startswith(myString, "prefix") then print("The string starts with prefix")Result:
The string starts with prefixThe string starts with prefixendswith(string, prefix)
- Returns 1 if the string ends with the defined prefix else returns 0.
Parameters
string(string): The string that needs to be checked.prefix(string): The prefix that needs to be checked.
Return
- (number): 1 if the string ends with the prefix else 0.
Example
myString = "the end of this string is prefix"if myString.endswith("prefix") then print("The string ends with prefix")if endswith(myString, "prefix") then print("The string ends with prefix")Result:
The string ends with prefixThe string ends with prefixtagstrip(string)
- Strips richtext tags from a string.
Parameters
string(string): The string that needs it’s richtext tags stripped.
Return
- (string): The string without richtext tags.
Example
myString = "<tags>String that would have tags normally</tags>"print(myString.tagstrip)print(tagstrip(myString))Result:
The string ends with prefixThe string ends with prefixformat(string, params)
- Formats a string to include the params.
Parameters
string(string): The string that needs to be formatted.params(list): A list with parameters that need to be included into the string.
Return
- (string|null): The formatted string to include the params. Or null when something went wrong.
Example
myString = "{} is {} years old and lives in {}"print myString.format(["Bob", "27", "Europe"])print format("{} is {} years old and lives in {}", ["Bob", "27", "Europe"])Result:
Bob is 27 years old and lives in EuropeBob is 27 years old and lives in Europeprintf(string, params)
- Prints a formatted string that includes the params.
Parameters
string(string): The string that needs to be formatted.params(list): A list with parameters that need to be included into the string.
Return
- (null): This returns nothing.
Example
printf("{} is {} years old and lives in {}", ["Bob", "27", "Europe"])Result:
Bob is 27 years old and lives in Europeformat_table(csv)
- Formats a string in a table format.
Parameters
csv(string): Csv that needs to be formatted to a table.
Return
- (string): The formatted table.
Example
print(format_table("#,username,password\n0,admin,s3cure!\n1,user,welcome123"))Result:
+---+----------+------------+| # | username | password |+---+----------+------------+| 0 | admin | s3cure! || 1 | user | welcome123 |+---+----------+------------+