Get Character At?

okibi okibi at ratedo.com
Tue Apr 24 10:39:53 PDT 2007


Tomas Lindquist Olsen Wrote:

> okibi wrote:
> >> 
> >> Why not just do:
> >> 
> >> char[] text = "some text";
> >> char num5 = text[5];
> >> 
> >> 
> > 
> > Because it isn't working for me. That was what I was trying to do seeing
> > as char[] is simply an array of characters. However, it's returning an int
> > and not a char.
> 
> import std.stdio;
> 
> void main()
> {
>     char[] text = "this is a sentence";
>     int loc = 5;
>     writefln("%s", typeid(typeof(text[loc])));
> }
> 
> this prints 'char' as expected...

That fixed the problem, thanks!


More information about the Digitalmars-d-learn mailing list