c# - Convert a word into character array -
how convert word character array?
lets have word "pneumonoultramicroscopicsilicovolcanoconiosis" yes word ! take word , assign numerical value it.
= 1 b = 2 ... z = 26 int alpha = 1; int bravo = 2;
basic code
if (testvalue == "a") { debug.writeline("true found in string"); // true finalnumber = alpha + finalnumber; debug.writeline(finalnumber); } if (testvalue == "b") { debug.writeline("true b found in string"); // true finalnumber = bravo + finalnumber; debug.writeline(finalnumber); }
my question how the word "pneumonoultramicroscopicsilicovolcanoconiosis" char string can loop letters 1 one ?
thanks in advance
what about
char[] myarray = mystring.tochararray();
but don't need if want iterate string. can do
for( int = 0; < mystring.length; i++ ){ if( mystring[i] ... ){ //do want here } }
this works since string
class implements it's own indexer
.
Comments
Post a Comment