SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Junior Member
    Join Date
    Feb 2008
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Eliminating WhiteSpaces

    Hi all, this is my first post in the forum so please pardon me if i made any mistakes. I'm currently working on one function that is able to read a particular .inc files and copy it into another inc files. The following is part of my function:

    <font class="small">Code:</font><hr /><pre>
    [-] for each sWrk in lsWrk
    [ ] iCnt++ //count line
    [ ] sWrk_Original = lsWrk[iCnt] // string of the line
    [-] if (MatchStr ("*<font color="red">[?] {sFucntionNber}</font>*", sWrk_Original))
    //do something
    </pre><hr />

    The problem i met is that the white spaces between [?] and {sFucntionNber} are not always uniform (it could be one space, two spaces or even more). How could i write the script to make it general ?

    Please advise me if my question is unclear. Thank you.

    Editted : Sorry for unclear question. The aim i wish to achieve is to reduce the white spaces if there are more than one:

    example 1:
    <font class="small">Code:</font><hr /><pre> problem:
    *[?] {sFucntionNber}* //there are 2 white spaces in between

    Desired result:
    *[?] {sFucntionNber}* //there is only one space in between.
    </pre><hr />

    example 2:
    <font class="small">Code:</font><hr /><pre>
    *[?] {sFucntionNber}* //there is one space in between and no change is needed.

    </pre><hr />



    Regards,
    Jacky

  2. #2
    SQA Knight
    Join Date
    Sep 2001
    Location
    Bangalore,India
    Posts
    2,549
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    Then use wild character *.
    Thanks & Regards,
    Palani.
    http://tips-testing.blogspot.com/index.html
    Quote: Donít hesitate to initiate!

  3. #3
    Member
    Join Date
    Nov 2001
    Location
    Darmstadt, Germany
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    What about this solution?

    if (MatchStr ("*[?]*{sFucntionNber}*", sWrk_Original))

  4. #4
    Member
    Join Date
    Nov 2001
    Location
    Darmstadt, Germany
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    Or just remove the the blanks before:
    <font class="small">Code:</font><hr /><pre>
    sWrk_Original = lsWrk[iCnt] // string of the line
    sWrk_Original = StrTran (sWrk_Original, " ", "")
    if (MatchStr ("*[?]{sFucntionNber}*", sWrk_Original))
    </pre><hr />

    Bye
    Patrick

  5. #5
    Junior Member
    Join Date
    Feb 2008
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    Thanks for the advices from PGoll and tmpalaniselvam, I really appreciate it. I'm very sorry but I think my question was stated wrongly and I have add in the edit portion into my first post.

    Please kindly give me some ideas of achieving the desire result.Thanks a lot.

  6. #6
    Member
    Join Date
    Sep 2006
    Posts
    57
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    Lookup StrPos and SubStr in help. You should be able to split your string into 2 substrings then join them together again with a space between.

  7. #7
    Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    I guess you just one to trim the white spaces to one between [?] and the next character, for that try using the code below:

    <font class="small">Code:</font><hr /><pre>
    [ ] INTEGER iCount = 0
    [ ] STRING a = "[?] {iCount}adfs"
    [ ] a = StrTran (a, " ", "")
    [ ] a= Stuff (a, StrPos ("]", a)+1, 0, " ")
    [ ] Print (a)
    </pre><hr />

    Hope I understood your problem
    SMP

  8. #8
    Junior Member
    Join Date
    Apr 2008
    Posts
    9
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    send me the exact code pleasr it is not working

  9. #9
    Member
    Join Date
    Nov 2001
    Location
    Darmstadt, Germany
    Posts
    51
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    Create a function like the above and send the string.
    The funciton will remove all double spaces.

    <font class="small">Code:</font><hr /><pre>
    string function (String sStringWithSpaces)
    while (StrPos(" ", sStringWithSpaces) != 0) // two blanks existent?
    sStringWithSpaces = StrTran (sStringWithSpaces, " ", " ")
    return sStringWithSpaces

    </pre><hr />

  10. #10
    SQA Knight
    Join Date
    Sep 2001
    Location
    Bangalore,India
    Posts
    2,549
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Eliminating WhiteSpaces

    How do you want to verify? Which one should get pass?
    Thanks & Regards,
    Palani.
    http://tips-testing.blogspot.com/index.html
    Quote: Donít hesitate to initiate!

 

 
Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin 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 11:53 AM.

Copyright BetaSoft Inc.