Hi John, In 1.10 the `string` type is just another name for a c_string (char *), this type has many problems: memory leaks, issues with transport across locales, etc. I've been working on improving the state of our strings for this coming release (1.11). The NewString module is the basis of this work, it is a string type that works like any other record in Chapel. You can use the type defined in NewString (string_rec) with 1.10, but be aware that the type hasn't been extensively used and some things will be renamed or changed in the (hopefully) near future.
Example of using string_rec: use NewString; var msg: string_rec = "Hello, World!" writeln(msg); string_rec doesn't have too many procedures, but it does have find and indexing (msg.substring(1..5) -> "Hello"). I don't think we have any of the others yet. > How difficult would it be to incorporate those changes to the Chapel's >string type? I would appreciate the help, but at this exact moment there isn't much anyone else can do. I have a lot of code that is floating about for switching our string type over to the record implementation that needs some other changes to go in before I can merge. Your mail reminded me that a string library proposal that was passed around never made it to chapel-users, I'll email that out shortly. There is a lot in that proposal left to work on, so if you are still interested in a few weeks there will be plenty to do. I'd be happy to help get you started on some routines then. -Kyle On 2/25/15, 2:13 PM, "John MacFrenz" <[email protected]> wrote: >Hi, > >I'm working on a simple file parser used to load configuration and fill >arrays. I need various helper methods like trim, find, tokenize, iterate >over string character by character, access character in string by >index... So, a few questions relating to this: > >- What is the role of the NewString.chpl file in modules/standard? I >noticed it has a find method but I can't figure how to use it... > >- How difficult would it be to incorporate those changes to the Chapel's >string type? If it was relatively easy and you would be interested I >could also contribute code with those features... > > >-------------------------------------------------------------------------- >---- >Dive into the World of Parallel Programming The Go Parallel Website, >sponsored >by Intel and developed in partnership with Slashdot Media, is your hub >for all >things parallel software development, from weekly thought leadership >blogs to >news, videos, case studies, tutorials and more. Take a look and join the >conversation now. http://goparallel.sourceforge.net/ >_______________________________________________ >Chapel-users mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/chapel-users ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Chapel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-users
