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
    Feb 2008
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    MatchStr() with case sensitive?

    I wrote a script which is able to search for a pattern using SilkTest function -- MatchStr(). However, the function is not able to recognize the case sensitive of the pattern.

    Is there any alternative method to have a function similar to MatchStr () but with the ability to detect case sensitive characters?

    Thanks in advance.

    Regards,
    Jacky

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

    Re: MatchStr() with case sensitive?

    Hi Jacky,

    Simple if statement with two string would do a case sensitive matching!

    <font class="small">Code:</font><hr /><pre>
    [-] if string1 == string2
    [ ] // do something
    [ ] else
    [-] Print ("strings does not match")
    </pre><hr />

    if you are writing a function to do case sensitive and case insensitive matching, you can take a boolean parameter for that and if it is say true use the code above else use MatchStr function.

    Hope this helps..
    SMP123

  3. #3
    Senior Member
    Join Date
    Aug 2004
    Location
    Dublin, Ireland
    Posts
    237
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr() with case sensitive?

    Nothing built in .. but you can do something like this using StrPos that s case sensitive :

    <font class="small">Code:</font><hr /><pre>
    [-] BOOLEAN MatchStr_CaseSensitive(STRING sToMatch, STRING sToSearchIn)
    [ ]
    [ ] return StrPos (sToMatch, sToSearchIn) &gt; 0

    </pre><hr />

  4. #4
    Advanced Member
    Join Date
    May 2005
    Location
    Fremont, CA
    Posts
    832
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr() with case sensitive?

    how about this:
    <font class="small">Code:</font><hr /><pre>
    boolean matchstring (str1, str2)
    return MatchStr (Upper(str1), Upper(str2))
    </pre><hr />

    This will compare 2 strings after they have been converted to upper case. That should solve your case sensitivity.

    dimaj

  5. #5
    Senior Member
    Join Date
    Feb 2006
    Location
    Princeton, NJ
    Posts
    195
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr() with case sensitive?

    [ QUOTE ]

    boolean matchstring (str1, str2) return MatchStr (Upper(str1), Upper(str2))

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


    This will compare 2 strings after they have been converted to upper case. That should solve your case sensitivity.


    [/ QUOTE ]
    Wrong: MatchStr is not case sensitive.
    MatchStr_CaseSensitive() from CasimiR should do it.

  6. #6
    Advanced Member
    Join Date
    May 2005
    Location
    Fremont, CA
    Posts
    832
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: MatchStr() with case sensitive?

    whoops!
    I guess it helps to carefully read the question [img]/images/graemlins/smile.gif[/img]

    dimaj

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

    Re: MatchStr() with case sensitive?

    Thanks for the replies, appreciate them [img]/images/graemlins/smile.gif[/img]

 

 

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 6.25%
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 10:12 AM.

Copyright BetaSoft Inc.