A collection of extension methods for strings
Usage:
- use this extension by adding this where you normally import modules:
using zero.extensions.StringExt;
- now you can use any of these functions on different arrays:
'ABCDEFG'.get_random(2); // 'GB'
- or use all of the extensions in this library by adding:
using zero.extensions.Tools;
Static methods
staticinlinecontains (src:String, value:String):Bool
checks to see if a string contains another string
* @param src input string
* @param value string query
* @return Bool return src.indexOf(value) >= 0
staticinlinecsv_to_2d_int_array (csv:String):Array<Array<Int>>
returns a 2D array of integers from a csv string
* @param csv input csv string
* @return Array<Array<Int>>
staticinlinecsv_to_int_array (csv:String):Array<Int>
returns an array of integers from a csv string
* @param csv input csv string
* @return Array<Int>
staticinlineget_random (string:String, length:Int = 1, ordered:Bool = false):String
Returns a set of letters from an input string, ordered returns a random chunk of the input string
Parameters:
string | input string |
---|---|
length | length of output |
ordered | whether to return a random set of letters (default) or an ordered chunk |
Returns:
String