Substring look-up

zxq9 zxq9@REDACTED
Wed Apr 7 12:42:23 CEST 2021

On 2021/04/07 19:37, Olivier Boudeville wrote:
> Hello Dan,
> Thanks for your answer; indeed rewriting most uses of string:rstr/2 in 
> terms of string:split/3 and others should be possible, and each string 
> traversal must be expensive now.

Sometimes going the neanderthal route is a simplification:

1. unicode:characters_to_list/1
2. write a custom function to iterate as a list the original way

The more complex the original representation and more interesting the 
sort of work you want done the more this approach tends to save me in 
both cognitive and processing overhead. My case may be highly optimized 
for this, though, as I usually deal with English, German and Japanese 
and rarely any other text input languages -- some input forms for other 
languages can get pretty interesting and probably don't map as well to 
the concept of "characters" after conversion.


More information about the erlang-questions mailing list