Add Str::index and Str::to_list
Strings can be converted to a list of strings, split up by character. Strings can also be indexed by character. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -157,6 +157,7 @@ pub fn init_types() {
|
||||
to_bool => BuiltinFunction::create("to_bool", BaseObj::to_bool, 1),
|
||||
to_int => BuiltinFunction::create("to_int", BaseObj::not_implemented_un, 1),
|
||||
to_float => BuiltinFunction::create("to_float", BaseObj::not_implemented_un, 1),
|
||||
to_list => BuiltinFunction::create("to_list", BaseObj::not_implemented_un, 1),
|
||||
len => BuiltinFunction::create("len", BaseObj::not_implemented_un, 1),
|
||||
|
||||
// Constructor
|
||||
@@ -204,6 +205,7 @@ pub fn init_types() {
|
||||
to_str => BuiltinFunction::create("to_str", Str::to_str, 1),
|
||||
to_int => BuiltinFunction::create("to_int", Str::to_int, 1),
|
||||
to_float => BuiltinFunction::create("to_float", Str::to_float, 1),
|
||||
to_list => BuiltinFunction::create("to_list", Str::to_list, 1),
|
||||
len => BuiltinFunction::create("len", Str::len, 1),
|
||||
|
||||
// Constructor
|
||||
@@ -214,6 +216,8 @@ pub fn init_types() {
|
||||
__add__ => BuiltinFunction::create("__add__", Str::add, 2),
|
||||
__mul__ => BuiltinFunction::create("__mul__", Str::mul, 2),
|
||||
|
||||
__index__ => BuiltinFunction::create("__index__", Str::index, 2),
|
||||
|
||||
// Methods
|
||||
// TODO Str methods - .lower, .upper, .slice, etc
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user