Please name the module 'bstring' in instead of 'string_as_binary'. :-)<br><br>Cheers!<br>Adam<br><br><div class="gmail_quote">On Fri, Mar 7, 2008 at 9:43 AM, Per Gustafsson <<a href="mailto:per.gustafsson@it.uu.se">per.gustafsson@it.uu.se</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Very good work, but I do have some comments:<br>
<br>
Just as for lists and strings I think that there should be two different<br>
modules one which just operates on binaries and one that operates on<br>
binaries which are really strings. This module seems to be first of<br>
these two for the most part so functions that only makes sense if the<br>
binaries are strings should probably reside in some other module. The<br>
string_as_binary module could have more or less exactly the same API as<br>
string and similar modules could be defined for utf8, utf16 and utf32 if<br>
necessary.<br>
<br>
* to_upper(Binary1) -> Binary2<br>
to_lower(Binary1) -> Binary2<br>
<br>
Should be in the string_as_binary module<br>
<br>
<br>
* binary_to_atom(Binary) -> Atom<br>
atom_to_binary(Atom) -> Binary<br>
<br>
As you write these should probably be in the erlang module along with<br>
<br>
binary_to_existing_atom(Binary) -> Atom<br>
<br>
<br>
* unsigned_to_bin(Integer)-> Binary<br>
<br>
What does this function do? Does it create the shortest possible binary<br>
in which the unsigned integer would fit?<br>
<br>
better names might be<br>
<br>
binary:from_unsigned(Integer) -> Binary<br>
binary:to_unsigned(Binary) -> Integer<br>
<br>
* nth(N, Bin) -> Value<br>
<br>
To also satisfy 0-indexers there should probably be a<br>
<br>
nth0(N, Bin) -> Value<br>
<br>
just as in the lists module<br>
<font color="#888888"><br>
<br>
Per<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br>