Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

Read string char by char.

  • Please log in to reply




  • Member
  • PipPipPip
  • 276 posts
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?


Count = 1
a = "Hello"
'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

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?


Edited by IO-error, 05 April 2007 - 07:53 AM.

  • 0




    Trusted Tech

  • Technician
  • 2,579 posts
What language are you trying to do this in? If it's VB.NET, I can show you how.
  • 0




  • Topic Starter
  • Member
  • PipPipPip
  • 276 posts
Oh, stupid me, I forgot to mention it was VBS...

Anyway, I got the hang of it now.


a = "grmblz"
b = len(a)

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

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.

Edited by IO-error, 07 April 2007 - 05:14 AM.

  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP