Can functions add properties?

2012-11-23 Thread Jun
I found some codes write toStringz(myString) as mystring.toStringz So I tested this code myself and it worked. int pow2(int i) { return i*i; } int myint = 5; int otherint = myint.pow2; assert(otherint == 25); I've never seen any documentation about this behaviour. I think it's a good

std.math and std.mathspecial

2012-01-16 Thread Jun
import std.math; import std.mathspecial; import std.stdio; void main(string[] args) { writeln(erf(0.5)); } I was writing on my phone, so I couldn't add some code. And, my pc browser won't load digitalmars.D html page, either, so I post this again here. It was okay before... maybe server

std.mathspecial conflicts with std.math

2012-01-15 Thread Jun
It seems here isn't write place for posting this, but my phone always fail to load digitalmars.D html page. (I cannot use my computer right now.) I was making a simple program and I had to use erfc() function, which is in std.mathspecial. I needed some functions in std.math. After importing it,

Printing wide characters in console

2011-01-07 Thread Jun
I think I found a solution for it. This code changes encoding of string to ansi which is default string encoding in windows console. import std.c.windows.windows; string ansi(string str) { wchar[] src = toUTF16(str).dup; char[] dest; dest.length = str.length;

Re: Wide characters are not printed properly

2011-01-06 Thread Jun
Thank you. It worked!

uniform()

2011-01-06 Thread Jun
Does anyone knows how can I set the boundary of uniform()? I got an error with uniform([], 0, 10);

Wide characters are not printed properly

2011-01-05 Thread Jun
Thank you for the answer, Vladimir, but it didn't work. The code page of my console was 949 which supports Korean characters. I tested with french and e with ` (I don't know its name)was not printed properly. Both wstring dstring resulted the same problem.

Asian characters are not printed propely in console

2011-01-04 Thread Jun
I'm sorry for posting in the wrong place. I attached screenshot of my code and the result. As you can see, Korean letters get changed after compilation. This problem doesn't happen with user input(from readln() method). Should I use different type and prefix or suffix similary to C++? begin