Read string char by char. - Geeks to Go Forums

Jump to content

Log in Register Register Malware removal guide How it works

Read string char by char.

#1 IO-error

  • Group: Member
  • Posts: 276
  • Joined: 10-March 06

Posted 05 April 2007 - 07:51 AM

Hi all,

Once again, I got a new idea for encoding.
Actually it was my first idea, but I got stuck on one thing.

How can I read the first or x-th character of a string?

Example:


Count = 1
a = "Hello"
Len(a)
do
'Code to use count as the indicator which char to read, example:
b = ReadString(Count,a)
c = Asc(b)
d = b/2
e = "." &d &"."Count = Count + 1
loop


A is now a string which contains "Hello" (without quoation marks).
What code or function would let me read the 2nd letter (e).

What I am trying to do is create a do loop.
First it checks how many chars there are in the string with Len()
Then the do loop reads the Count variable and uses that as which character to read.

Is there something of FSO that I can use?
Or IO-stream?

And how do I put a TAB in a post?

TIA

#2 stettybet0

  • Group: Technician
  • Posts: 2,579
  • Joined: 15-June 05

Posted 06 April 2007 - 02:19 PM

What language are you trying to do this in? If it's VB.NET, I can show you how.

#3 IO-error

  • Group: Member
  • Posts: 276
  • Joined: 10-March 06

Posted 07 April 2007 - 05:13 AM

Oh, stupid me, I forgot to mention it was VBS...

Anyway, I got the hang of it now.

example:

a = "grmblz"
b = len(a)

count = 1
Do Until count = b + 1
y = mid(a,count,1)
msgbox y
count = count + 1
Loop

***EDIT***
Now the only thing I need to get done is that it will write the encrypted outcome of the letters in a textfile, which isn't that hard.

Share this topic: