PDA

View Full Version : While loop in a string



Option_Explicit
03-03-2003, 08:34 PM
Ok I'll ask this first, then I'll post some sort of example of what I actually want to do.
If I GetDelimited string....I need to extract one part of it, it's going to be a different length every time, but I can get the first and last positions on each side of the string part I want.
Once I get my first <start at position>, how do I tell it when to end? I need to be able to say...
Find in string "{" - get position (position 32)
now start from position 32 and get the next 56 characters after that position and return to %newstring%
Would this need a while loop in the string to do this?
Ideas? or I'll be more specific in what I'm trying to accomplish here next post.

Worm
03-03-2003, 09:04 PM
I'm not quite sure I understand what your asking. If you have delimited string, then you need only do:
%NewString% = String.GetDelimitedString ("a;;b;;cat;;d", ";;", 3)
NewString would equal "cat", it doesn't matter about the length, it simply takes the third string that is between the delimiters.

If your asking how to get the middle of a string,
%NewString% = String.Mid ("This is a sample", 5, 2)
NewString would equal "is"

The code is saying start at character 5 and return the next 2 characters.

So I think your looking at something like this:
%FoundPos% = String.Find ("%YourString", "{", 0)
%NewString% = String.Mid ("%YourString%", %FoundPos%, 56)

Option_Explicit
03-03-2003, 09:44 PM
Worm......I love ya
Works 100%
What I was doing, is making a process to search for .dbx mail files on a Local Drive.
Then find the CLSID and User name associated with them, (lost or otherwise)
Create a folder named the CLSID name for each set found, and copy all the contents from each corresponding CLSID key into their own folder.

Worm
03-04-2003, 06:42 AM
Awww Shucks!

Corey
03-04-2003, 07:10 AM
/ubbthreads/images/icons/smile.gif

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)