Prab Posted October 7, 2008 Share Posted October 7, 2008 Hi, Does anyone know if there is a way to adjust a Char like in C? For example, I want to make "a" + 1 = "b". I tried this in MsgBox, but the only output was "1". I could write this in C (or maybe Java), but I want to show my CS teacher how powerful AutoIt is. Thanks for your help. Prab FolderLog GuiSpeech Assist Link to comment Share on other sites More sharing options...
Malkey Posted October 7, 2008 Share Posted October 7, 2008 Hi, Does anyone know if there is a way to adjust a Char like in C? For example, I want to make "a" + 1 = "b". I tried this in MsgBox, but the only output was "1". I could write this in C (or maybe Java), but I want to show my CS teacher how powerful AutoIt is. Thanks for your help. PrabYou could try this. $b = chr(asc("a")+1) MsgBox(0, "", $B) Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 7, 2008 Share Posted October 7, 2008 You could take the ascii code and add to that value then translate it back I suppose. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
Prab Posted October 7, 2008 Author Share Posted October 7, 2008 Thanks so much, that worked perfectly. Anyone willing to help debug an OB1 error? expandcollapse popup#include <Array.au3> $file = FileOpen("test.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in 1 character at a time until the EOF is reached $chars = "" While 1 $chars &= FileRead($file, 1) If @error = -1 Then ExitLoop Wend MsgBox(0, "Input String: ", $chars) Local $answerArray[1] $answerArray[0] = $chars For $x = 1 To 25;cycle through all possiblities in the alphabet. $newString = "" For $y = 0 To StringLen($chars) - 1;convert all letters in the string $tempChar = StringMid($chars, $y + 1, 1) If $tempChar = "z" Then $tempChar = "a"; only work with "a" through "z" If StringIsAlNum($tempChar) Then $adjustedChar = Chr(asc($tempChar)+1) Else $adjustedChar = " ";leave spaces alone EndIf $newString &= $adjustedChar Next _ArrayAdd($answerArray, $newString) $chars = $newString Next _ArrayDisplay($answerArray) FileClose($file) FolderLog GuiSpeech Assist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now