SPONSORS:






User Tag List

Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Oct 1999
    Location
    St. Paul, MN
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stripping text (found multiple times)

    I trying to strip some dynamic text from a file. I have so far been successful in doing so using the StrPos function.

    The text I'm trying to strip out is
    UserGuidRef="*" and it's always followed by
    UserRef="*"

    So I'm able to do something like this:

    // starting position of UserGuidRef
    iPos1 = StrPos ("UserGuidRef=", sChanged)
    Print ("Position = ", iPos1)

    // ending position of the Guid
    iPos2 = StrPos ("UserRef=", sChanged)
    Print ("Position = ", iPos2)

    // what to remove from the line - basically the UserGuidRef="*"
    iPos3 = iPos2 - iPos1

    // UserGuidRef - strip it all out - sChanged is now the line with UserGuidRef="*" removed

    sChanged1 = Stuff(sChanged, iPos1, iPos3, "")


    I just ran into a problem though, where the specific text I want to strip out is found multiple times in the line (and always followed by UserRef). I want to remove the UserGuidRef all together, but not the UserRef. My problem is after stripping out the first one in the line, and searching for the second, I'm given the position for the second, but when getting the position for the UserRef, I'm given the first position. Is there a way for me to search for the next occurrence of UserRef that anyone knows of? The bBackward won't help me, because it can be found on the same line more than twice ....

    Thanks much,
    Dana

    ------------------

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Stripping text (found multiple times)

    Have you tried using strTran()?

    ------------------

  3. #3
    Member
    Join Date
    Oct 2001
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Stripping text (found multiple times)

    Dana,

    Have you tried using GetField to get the text you want to remove then StrTran to replace it. Doing this should get you round any multiple instance problems.

    Paul

    ------------------
    Paul Tucker
    Merit AT
    www.merit-at.com
    Paul Tucker
    Merit AT
    www.merit-at.com

  4. #4
    Member
    Join Date
    Oct 1999
    Location
    St. Paul, MN
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Stripping text (found multiple times)

    Thanks,

    I had looked at StrTran, and initially wrote it off because the original stuff I was stripping from the file was dynamic in length... I think I can probably figure out a way to grab it and then remove it.

    Thanks much.

    Dana

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:19 PM.

Copyright BetaSoft Inc.