Get Character At?

Tomas Lindquist Olsen tomas at famolsen.dk
Tue Apr 24 09:02:16 PDT 2007


okibi wrote:

> Derek Parnell Wrote:
> 
>> On Tue, 24 Apr 2007 10:30:16 -0400, okibi wrote:
>> 
>> > Is there a getCharAt() function for D?
>> 
>> Get a character from what? A string, a file, a console screen, ... ?
>> 
>> --
>> Derek Parnell
>> Melbourne, Australia
>> "Justice for David Hicks!"
>> skype: derek.j.parnell
> 
> Such as this:
> 
> char[] text = "This is a test sentence.";
> 
> int loc = 5;
> 
> char num5 = text.getCharAt(loc);
> 
> Something along those lines.

Why not just do:

char[] text = "some text";
char num5 = text[5];




More information about the Digitalmars-d-learn mailing list