notpron

git clone git://xatko.vsos.ethz.ch/notpron.git
Log | Files | Refs

atoz.js (390B)


      1 function char_atoz_pos(string,pos){
      2 	a=("a").charCodeAt(0);
      3 	z=("z").charCodeAt(0);
      4 	c=string.charCodeAt(pos);
      5 	if(c>=a&&c<=z){
      6 		return String.fromCharCode(a+z-c);
      7 	}
      8 	else{
      9 		return "";
     10 	}
     11 }
     12 function string_atoz(string){
     13 	var i;
     14 	var nstr="";
     15 	for(i=0; i<string.length; i++){
     16 		if(string.charAt(i)==" "){
     17 			nstr+=" ";
     18 			continue;
     19 		}
     20 		nstr+=char_atoz_pos(string,i);
     21 	}
     22 	return nstr;
     23 }