Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
November 01, 2003 String class | ||||
---|---|---|---|---|
| ||||
I believe once I saw a String class submited on this group to be added to phobos (seems that it never made it - I think it was from Burton Radons). (A standard String class should be available) Any one has that String class (or another that can be shared) or remember how to get it? Thanks Ant |
November 01, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | In article <bo0s52$cqn$1@digitaldaemon.com>, Ant says... > > >I believe once I saw a String class submited on >this group to be added to phobos >(seems that it never made it - I think it was from Burton Radons). > >(A standard String class should be available) Probably what I saw was http://www.digitalmars.com/drn-bin/wwwnews?D/6204 (seems nothing from there got into phobos) anybody has a String class to share with us? Ant |
November 01, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | I think it would be super great if char[] were powerful enough that we don't need any string class. Most of the basics of C strings, such as strcpy, strcat, strlen, are already handled by char[] and slices of char[], and array concatenation ~. Many other basic string functions are actually useful on other kinds of arrays as well. Array search, array comparison. So there's no need to make such functions specific to char[] only. There are plenty of issues regarding Unicode encoding that just don't fit well with char[]. case-sensitive or locale-specific comparisons, "indexing" of UTF-8 encoded strings, etc. And we do need some place to hang functions that work on strings, something that hopefully will eliminate the need for "str" prefixes on the function names. Sean "Ant" <Ant_member@pathlink.com> wrote in message news:bo0tas$ej4$1@digitaldaemon.com... > In article <bo0s52$cqn$1@digitaldaemon.com>, Ant says... > > > > > >I believe once I saw a String class submited on > >this group to be added to phobos > >(seems that it never made it - I think it was from Burton Radons). > > > >(A standard String class should be available) > > Probably what I saw was > > http://www.digitalmars.com/drn-bin/wwwnews?D/6204 > (seems nothing from there got into phobos) > > anybody has a String class to share with us? > > Ant |
November 02, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | In article <bo178s$s3p$1@digitaldaemon.com>, Sean L. Palmer says... > >I think it would be super great if char[] were powerful enough that we don't need any string class. The main problem is that char[] is not an object. >There are plenty of issues regarding Unicode encoding that just don't fit well with char[]. case-sensitive or locale-specific comparisons, "indexing" of UTF-8 encoded strings, etc. And we do need some place to hang functions that work on strings, How about a String class? ;) Ant |
November 03, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | >
>anybody has a String class to share with us?
>
I just looked at STL.
(I used C++ on DOS, not even on windows 3.0)
it seems that it contains a string thing so I
guess we are all waiting for the big D lib,
ok, let's wait.
Ant
|
November 03, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant Attachments: | I made this a few weeks ago. |
November 03, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | In article <bo6a9k$1vag$1@digitaldaemon.com>, Vathix says... > >I made this a few weeks ago. > Looks great! thank you. Ant |
November 03, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | Looks interesting. If I started using this in my own code what advantages would it have over using string.d and schar[] where schar is char, wchar or dchar? I haven't been following the pros and cons of String vs char[] aside from the UTF-n indexing problem. thanks, -Ben "Vathix" <vathix@dprogramming.com> wrote in message news:bo6a9k$1vag$1@digitaldaemon.com... > I made this a few weeks ago. > > > > > |
November 04, 2003 Re: String class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | The String class has a few advantages like the reserve member to reserve so many bytes to avoid reallocations. You can append another String, char[], char or even int to it. The silce operator (with or without parameters) returns a char[] so it can be easily used with other char[] string functions. The toStringz member adds the null byte to the reserve so calling it several times won't hurt any. There are a few bad things, like the functions that return several new String objects such as split(), but I don't really think it's any worse than other languages' String classes. I wrote this code just for something to do, since people have been wanting a String and it didn't look like anyone was actually making it. I still like char[], I think slices are really cool. "Ben Hinkle" <bhinkle4@juno.com> wrote in message news:bo6osb$2kf3$1@digitaldaemon.com... > Looks interesting. If I started using this in my own code what advantages would it have over using string.d and schar[] where schar is char, wchar or > dchar? I haven't been following the pros and cons of String vs char[] aside > from the UTF-n indexing problem. > thanks, > -Ben > > > "Vathix" <vathix@dprogramming.com> wrote in message news:bo6a9k$1vag$1@digitaldaemon.com... > > I made this a few weeks ago. > > > > > > > > > > > > |
Copyright © 1999-2021 by the D Language Foundation