Jump to content

read text in text area character by character and display character


Recommended Posts

Hello,

I am trying to read text that has been previously entered into a text area.

I can do it by storing all text into a variable (like shown below), but I want to read the text now character by character.

That is, read the first character and do something with it. Then read the second character and so on. Untill the text in the text area ends...

How can I do this?

;Read text from input box
                Local $readedText = GUICtrlRead($idEditText)

Edited by neazoi
Link to comment
Share on other sites

Never mind, I did that with

;Read text from input box
               Local $readedText = GUICtrlRead($idEditText)
               Local $char = StringSplit($readedText, "")
               For $i = 1 to $char[0]
                  Local $play1 = "\alphabet\"
                  Local $play2 = ".wav"
                  SoundPlay(@ScriptDir &$play1&$char[$i]&$play2, 1)
               Next

Thanks!

Link to comment
Share on other sites

  • Moderators

StringSplit the text:

#include <Array.au3>

$aString = StringSplit("This is my saved string", "")
    _ArrayDisplay($aString)

Edit: Too slow :)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

StringSplit() used as below will give you an array with each element being a single character, You can then loop through the array doing whatever you need to with each character.

Local $readedText = GUICtrlRead($idEditText)
Local $arrayOfCharacters = StringSplit ( $readedText, "",  $STR_NOCOUNT)

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...