www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - char/string count...?help me please..

reply Pieter Valdano Pattiruhu <pieter_ambonese yahoo.co.id> writes:
dear senior,
my name is pieter from indonesia(an amateur person in D programming)...
i just want to ask the syntax to count an input string from user...
as we know in C we should use "strln"....how bout in D?.
if don't mind please give me example a little piece of char/string count
program...
thank you for your attention...God Bless U always...

nb: please reply to pieter_ambonese yahoo.co.id
 
Jun 19 2007
parent reply vermi <moi_anti_spam_ vermi.fr> writes:
you string is a char array ? Try array.length !
Jun 19 2007
parent pieter Valdano pattiruhu <pieter_ambonese yahoo.co.id> writes:
vermi Wrote:

 you string is a char array ? Try array.length !

here is my count char program: import std.stdio; import std.string; void main() { char* s; char string[100]; writef("please input your text="); scanf("%s",&string); writef("your text length is=",string.length); } does my program work properly?. when i try to run it, d compiler tell that can't convert string to int. please show me the way to convert string into integer. (if you don't mind i need your correction in my simple char program). thank you very much...GBU
Jun 19 2007