SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Jun 2005
    Location
    Montreal
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    MatchStr("***********",sTest) always true

    Hi,

    Here is what I have to do :

    I have a LIST of STRING (lsExtract), approximately like this (spaces at the begin of each line has been remove in the post, but in fact, there is some spaces at the beginning of each line):

    MyTest
    ***Info
    Info
    ...
    ******************************************
    **********
    Machine : pc3360
    Platform: Microsoft Windows XP [Version 5.1.2600]|SP0|6.0.2800.1106
    ***********************************

    I need to put what is between the first and the last ************ in another list of string. To do this, I need the index of the first line containing ************

    My problem :

    I'm not able to do MatchStr and put some * in the first parameter. Silktest always take it as a wildcard.

    I have tried :

    MatchStr("*************", lsExtract[i]) -> always true

    MatchStr("*'*", lsExtract[i])-> true when there is only 2 **.

    MatchStr("*'*'*'*'**", lsExtract[i])-> always False

    MatchStr("*'******'*", lsExtract[i])-> Always false

    Do you have any idea how to tell silktest that * is not a wildcard ? If not, is there another way to find the index of the string containing ******************* ? Other posts talk about this, but none of them gives a true answer, they decided to avoid the problem.


    Thanks

    Jacob

  2. #2
    Super Member
    Join Date
    Jul 2003
    Location
    Boulder, CO
    Posts
    1,276
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr("***********",sTest) always true

    Have you tried calling ASC() in a loop for each character? You could loop through the string (or each string) checking to see if Asc(YourString[index]) == 42.

    http://www.newebgroup.com/academy/tables/ascii.htm

    Someone else asked this recently, but I don't if Asc() worked for them or not.

    For your purposes, it seems like you could simply do this:

    Assume inStrings is your input list.
    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">LIST OF STRING outStrings = {...}
    STRING oneString
    for each oneString in inStrings
    if (Asc(oneString[1]) != 42)
    ListAppend(outStrings, oneString)

    ListPrint(outStrings)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">If you wanted to find data later in a string that starts with *, then:

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">LIST OF STRING outStrings = {...}
    STRING oneString
    for each oneString in inStrings
    int index = 0
    if (Asc(oneString[1]) == 42)
    while (Asc(oneString[index]) == 42)
    index++
    STRING newSubStr = SubStr(oneString, index)
    ListAppend(outStrings, newSubStr)
    else
    ListAppend(outStrings, oneString)

    ListPrint(outStrings)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">

    [ 06-22-2005, 02:09 PM: Message edited by: Chris Mead ]
    Chris R Mead

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

  3. #3
    Junior Member
    Join Date
    Jun 2005
    Location
    Montreal
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr("***********",sTest) always true

    Thanks, finally, I think that I'm also gonna avoid the problem, here a solution that works for me.

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[-] for( i = 1; i &lt;= iNbLines ; i++)
    [ ] iLen = Len(lsExtract[i])
    [-] for(j = 1 ; j &lt;= iLen; j++)
    [-] if(lsExtract[i][j] == '*')
    [ ] CountAst++
    [-] if(CountAst == 42)
    Print(&quot;Found it&quot</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">It's not pretty, probably could be shorter, but it works.

    Thanks again

    Jacob

  4. #4
    Super Member
    Join Date
    Jul 2003
    Location
    Boulder, CO
    Posts
    1,276
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr("***********",sTest) always true

    lsExtract doesn't show up in Help (for me, at least). Where did you find it?
    Chris R Mead

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

  5. #5
    Junior Member
    Join Date
    Jun 2005
    Location
    Montreal
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr("***********",sTest) always true

    lsExtract is only the name of my LIST of STRING (because it contains the text of the extracted result of my SilkTest tests).

    I should have put this in the code I pasted :

    LIST of STRING lsExtract

    Sorry if I wasn't clear.

    Jacob

    PS The code of your last post didn't appear when I posted my last post, so I didn't have the chance to try it.

  6. #6
    Super Member
    Join Date
    Jul 2003
    Location
    Boulder, CO
    Posts
    1,276
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr("***********",sTest) always true

    Oh yeah... duh. I really got thrown off by your use of 42 also. Why did you use 42 there at the end? Are there 42 *'s or something?
    Chris R Mead

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

  7. #7
    Junior Member
    Join Date
    Jun 2005
    Location
    Montreal
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr("***********",sTest) always true

    Exactly, there are 42 *'s on the line that I want to find.


    Thanks

    Jacob

 

 

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 11.54%
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 06:53 PM.

Copyright BetaSoft Inc.