Anonymous user
Regular expressions: Difference between revisions
Added Erlang
(Added R code) |
(Added Erlang) |
||
Line 258:
Note that in std.string there are string functions to perform those string operations in a faster way.
=={{header|Erlang}}==
<lang erlang>
match() ->
String = "This is a string",
case re:run(String, "string$") of
{match,_} -> io:format("Ends with 'string'~n");
_ -> ok
end.
substitute() ->
String = "This is a string",
NewString = re:replace(String, " a ", " another ", [{return, list}]),
io:format("~s~n",[NewString]).
</lang>
=={{header|Forth}}==
|