Nanu library on dsource
Mark Mohr
markm11 at charter.net
Fri Feb 1 05:30:38 PST 2008
OK..
It is a converting Mono to D. This will enable anyone who wrote C# code in .Net. To recompile in D.
There will be some minor tweaking but the syntax for the most part will remain the same.
There is still a lot do do and check out the dsource page.
http://www.dsource.org/projects/nanu
If interested in helping out let me know.
here is an example...
import system.console;
import system.int32;
import system.text.asciiencoding;
import system.text.utf8encoding;
int main(){
try{
// The endoding.
//ASCIIEncoding e = new ASCIIEncoding();
UTF8Encoding e = new UTF8Encoding();
// A Unicode string with two characters outside the ASCII code range
nchar[] unicodeString = "This Unicode string contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3).";
Console.WriteLine("Original string:");
Console.WriteLine(unicodeString);
Console.WriteLine("Length = " ~ Int32(unicodeString.length).ToString());
Console.WriteLine();
ubyte[] encodedBytes = e.GetBytes(unicodeString);
foreach(ubyte b; encodedBytes){
Console.Write("[" ~ Int32(cast(int)b).ToString() ~ "]");
}
Console.WriteLine();
nchar[] decodeString = e.GetString(encodedBytes);
Console.WriteLine();
Console.WriteLine("Decoded bytes:");
Console.WriteLine(decodeString);
}
catch(Exception e){
Console.WriteLine(e.ToString());
}
return 0;
}
J Duncan Wrote:
> Mark Mohr wrote:
> > The nanu library source that I have been working on is now on dsource.
>
> Uh.... you may want to tell people what it is....
More information about the Digitalmars-d-announce
mailing list