Announcement

Collapse
No announcement yet.

While loop in a string

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • While loop in a string

    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.

  • #2
    Re: While loop in a string

    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)

    Comment


    • #3
      Re: While loop in a string

      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.

      Comment


      • #4
        Re: While loop in a string

        Awww Shucks!

        Comment


        • #5
          Re: While loop in a string

          [img]/ubbthreads/images/icons/smile.gif[/img]

          Corey Milner
          Creative Director, Indigo Rose Software

          Comment

          Working...
          X