mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 21:35:03 +00:00
add string replace
This commit is contained in:
parent
b568ece8f0
commit
42441e78c2
@ -17,7 +17,7 @@ class Strings implements ILib
|
||||
fn (string $a) => strtoupper($a)
|
||||
));
|
||||
|
||||
$env->set('locase', new CoreFunc('locase', 'Return string in lower case.', 1, 1,
|
||||
$env->set('lowcase', new CoreFunc('lowcase', 'Return string in lower case.', 1, 1,
|
||||
fn (string $a) => strtolower($a)
|
||||
));
|
||||
|
||||
@ -31,6 +31,10 @@ class Strings implements ILib
|
||||
}
|
||||
));
|
||||
|
||||
$env->set('replace', new CoreFunc('replace', 'Change occurrences in first argument from second argument to third argument.', 3, 3,
|
||||
fn (string $a, string $b, string $c) => str_replace($b, $c, $a)
|
||||
));
|
||||
|
||||
$env->set('split', new CoreFunc('split', 'Split the second argument by the first argument into a list.', 2, 2,
|
||||
fn (string $a, string $b) => new MList(explode($a, $b))
|
||||
));
|
||||
|
Loading…
Reference in New Issue
Block a user