digitalmars.D - Download link to StringW.d - std.string functions for wchar[]s
- David L. Davis (66/66) Sep 04 2004 If someone else (besides myself) is having GREAT pains using wchar[]s wi...
If someone else (besides myself) is having GREAT pains using wchar[]s with Phobos runtime library std.string functions, then this module might be very(StringW.d) usefull, and hopefully Walter will fix the naming / parameter conflicts that are going on between the char[], wchar[], and dchar[] characters. Darn it! If I'd just kept my head in the sand, my project would've been farther along, but I got the bright idea the other day to switch from using char[]'s to wchar[]s to make the code more useful to others. Yet I'm still glad I did make the change, I just hope things can be solved soon. Anyways here's a link to download StringW.d from my "Support Projects" page: http://spottedtiger.tripod.com/D_Language/D_Support_Projects_XP.html And here's some info from the readme: /+ ' File / Module : stringw.d / std.stringw ' Version : v0.1 beta ' Author : David L. 'SpottedTiger' Davis ' Complied : DigitalMars "D" aka Mars v0.101 ' Created Date : 03.Sep.04 Complied and tested with dmd v0.101 ' Modified Date : 04.Sep.04 Added unittests for every function. ' : ' : Darn it...I just had to add a "W" suffix to the ' : function names so these function can play in the same ' : sandbox as Phobos' std.string function. ' : ' Requirements : Must complie with dmd v0.92+ and above, ' : because of default parameters were used. ' Licence : Public Domain ' --------------------------------------------------------------------------- ' Note: This module is meant to extend Phobos' std.string functions ' with support for wchar[] characters. Also though Phobos' char[] functions ' were used as the bases for these functions, only function descriptions ' and most of unittest were copied and used here. As for the look alike ' wchar[] functions, I've rewritten them all... and thus, this code may not ' perform as well as code written by Walter. Over time I hope to add more ' functions, and to better fine tune the existing ones more. ' ' Wide-Character (16-bit) "Non-Case Sensitive" functions. ' 01) int ifindW( in wchar[], in wchar ) ' 02) int ifindW( in wchar[], in wchar[] ) ' 03) int irfindW( in wchar[], in wchar ) ' 04) int irfindW( in wchar[], in wchar[] ) ' 05) int icmpW( in wchar[], in wchar[] ) ' 06) wchar[] ireplaceW( in wchar[], in wchar[], in wchar[] ) ' 07) int icountW( in wchar[], in wchar[] ) ' 08) int ifindxW( in wchar[], in wchar[], in int = 0 ) ' 09) int irfindxW( in wchar[], in wchar[], in int = 0 ) ' 10) wchar[][] isplitW( in wchar[], in wchar[] ) ' ' Wide-Character (16-bit) "Case Sensitive" functions. ' 01) int findW( in wchar[], in wchar ) ' 02) int findW( in wchar[], in wchar[] ) ' 03) int rfindW( in wchar[], in wchar ) ' 04) int rfindW( in wchar[], in wchar[] ) ' 05) int cmpW( in wchar[], in wchar[] ) ' 06) wchar[] replaceW( in wchar[], in wchar[], in wchar[] ) ' 07) int countW( in wchar[], in wchar[] ' 08) int findxW( in wchar[], in wchar[], in int = 0 ) ' 09) int rfindxW( in wchar[], in wchar[], in int = 0 ) ' 10) wchar[][] splitW( in wchar[], in wchar[] ) ' +/ Unzip "stringw.d", which will put the file into the "\dmd\src\phobos\std" directory. Then to use the module within your code just add the line "import std.stringw;" and you're set. David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
Sep 04 2004