Index: ossp-pkg/str/TODO RCS File: /v/ossp/cvs/ossp-pkg/str/TODO,v co -q -kk -p'1.20' '/v/ossp/cvs/ossp-pkg/str/TODO,v' | diff -u /dev/null - -L'ossp-pkg/str/TODO' 2>/dev/null --- ossp-pkg/str/TODO +++ - 2024-05-20 03:07:38.417892667 +0200 @@ -0,0 +1,65 @@ + ____ _ + / ___|| |_ _ __ + \___ \| __| '__| + ___) | |_| | + |____/ \__|_| + + Str - String Library + + TODO + + o look at printf ideas from ../stdio/printf!! + o look at ../strnatcmp + + The following *have* to be done before 1.0.0: + + o perhaps a str_shave() or str_strip() function which + allows one to strip off characters out of a set from + begin and end of a string. Usually for zapping whitespaces + from begin and end of string. + => str_shave(" \t foo bar ", " \t\n") => "foo bar" + + o use stdio-style "t" strings insead of STR_TRIGRAPH bitmasks + o finish str_test.c: more tests + o Dean wrote: btw -- str_compare taking a mode argument doesn't let you trim a few + cycles by going into strcmp/strcasecmp which are usually hand-tuned + assembly beasts on most boxes. i'd go for str_compare and + str_casecompare. + + The following *could* be done before 1.0.0: + + o Unicode/UTF-8 support!! + o str_encode/str_decode: + - plain base64 + - strict base64 (with newlines and padding, etc.) + o str to/from symbol conversion: + - long str_symbol(char *str); + o str_format merged with strptime + o str_locate could become a "mode" argument which + indicates whether "s" is small or large and if + it is small a (faster) brute force search could be done. + o str_parse could support s/.../g or even m/.../g + o one could add "vstr" support with own malloc + Dean wrote: have you seen djb's stralloc stuff? it's part of qmail. + it looks like a nice way to avoid thinking about lengths. + +> I really like your Str library, but I have a question: +> +> What is its equivalent og the Perl 'g' modifier, such as in this example +> (Perl): +> +> $teststr = 'hello/world/nice/to/meet/you'; +> $teststr =~ s/\//:/g; +> # $teststr == 'hello:world:nice:to:meet:you'; +> +> I couldn't find it in the documentation. Has this been implemented yet? +> If not, is there some other way of doing it? + +Hmmm... yes, I initially left our the /g variant because I thought just +about _matching_ like in m/.../g. But that was silly. You're right, +for s/.../ the global flag is very important. It is currently still +not implemented, but I've now added it to my TODO list for Str. OTOH +your s/\//:/g usually can be performed more easier without str_parse, +of course. Just use str_span() in a loop and replace the underlaying +character in each step until str_span reached the end of the string. +