Sign in to follow this  
Followers 0
neazoi

read text in text area character by character and display character

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

StringSplit the text:

#include <Array.au3>

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

Edit: Too slow :)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0