On 4/30/12, WhatMeWorry <kc_hea...@yahoo.com> wrote:
> I'm trying to get my head around D's type conversion. What is the
> best way to convert a string to a char array? Or I should say is
> this the best way?
>
> string s = "Hello There";
> char[] c;
>
> c = string.dup;
>

Well it depends . Why do you need a char[]? If you're interfacing with
C you most likely need a 0-terminated string and not a char[].

> Also, what is the best way to explicitly convert a string to an
> int?

import std.conv;
int i = to!int("12345");

Reply via email to