www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Nanu library on dsource

reply Mark Mohr <markm11 charter.net> writes:
The nanu library source that I have been working on is now on dsource.
Jan 31 2008
parent reply J Duncan <jtd514_ ameritech.net> writes:
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....
Jan 31 2008
parent reply Mark Mohr <markm11 charter.net> writes:
OK..


.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....
Feb 01 2008
parent Lionello Lunesu <lio lunesu.remove.com> writes:
Mark Mohr wrote:
 OK..
 

.Net.  To recompile in D. 
I think this is a brilliant idea! L.
Feb 01 2008