Fire 3 Posted June 21, 2010 (edited) Hi Great Community!Guys i`m in stuck.Because i don`t know how to convert letters to decimal which will give me result like below:http://www.pctools.com/guides/registry/detail/1281/A: 1 B: 2 C: 4 D: 8 E: 16 F: 32 G: 64 H: 128 I: 256 J: 512 K: 1024 L: 2048 M: 4096 N: 8192 O: 16384 P: 32768 Q: 65536 R: 131072 S: 262144 T: 524288 U: 1048576 V: 2097152 W: 4194304 X: 8388608 Y: 16777216 Z: 33554432 ALL: 67108863I try many ways how to convert letters to decimal but as result i cannot figure it out.I mean my result is wrong.Guys I need only right direction.Thanks and Thanks in advance again. Edited June 21, 2010 by Fire [size="5"] [/size] Share this post Link to post Share on other sites
Mat 376 Posted June 21, 2010 2^(Asc($sChar)-65) AutoIt Project Listing Share this post Link to post Share on other sites
Malkey 231 Posted June 21, 2010 Here is another direction. For $i = 0 To 25 ConsoleWrite(ChrW($i + 65) & ": " & 2 ^ $i & @CRLF) Next ConsoleWrite("ALL: " & 2 ^ $i - 1 & @CRLF) #cs A: 1 B: 2 C: 4 D: 8 E: 16 F: 32 G: 64 H: 128 I: 256 J: 512 K: 1024 L: 2048 M: 4096 N: 8192 O: 16384 P: 32768 Q: 65536 R: 131072 S: 262144 T: 524288 U: 1048576 V: 2097152 W: 4194304 X: 8388608 Y: 16777216 Z: 33554432 ALL: 67108863 #ce Share this post Link to post Share on other sites
funkey 128 Posted June 21, 2010 ConsoleWrite(_Letter2Dec("z") & @CR) ConsoleWrite(_Letter2Dec("A") & @CR) Func _Letter2Dec($sLetter) $sLetter = StringLeft(StringUpper($sLetter), 1) If Not StringIsAlpha($sLetter) Then Return SetError(1) Local $iAsc = Asc($sLetter) - 65 Return 2^$iAsc EndFunc Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Share this post Link to post Share on other sites
Fire 3 Posted June 21, 2010 (edited) Mat,Malkey,funkey Thanks so much Guys! Solved.Thanks again. Edited June 21, 2010 by Fire [size="5"] [/size] Share this post Link to post Share on other sites