SPONSORS:






User Tag List

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

    StrComp giving problem

    Hi ,

    I am using StrComp to compare 2 strings
    sExpMsg = "No records found"
    sActMsg =Browser("Browser").Object.StatusText
    print sActMsg
    i = StrComp(trim(sExpMsg),trim(sActMsg),1)
    Print i
    The two srtings are equal, but still it is giving value of i =1.
    Please help.

  2. #2
    Senior Member
    Join Date
    Feb 2008
    Location
    Los Angeles, CA, USA
    Posts
    861
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: StrComp giving problem

    Try this,
    i = StrComp(trim(lcase(sExpMsg)),trim(lcase(sActMsg)),1)
    -Suchit

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

    Re: StrComp giving problem

    Hmm..This doesnt work too

  4. #4
    Senior Member
    Join Date
    Aug 2004
    Location
    Bloomington, IL
    Posts
    300
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: StrComp giving problem

    Try this,

    i = StrComp(trim(cstr(sExpMsg)),trim(cstr(sActMsg)),1)

    Thanks,
    Ashok

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

    Re: StrComp giving problem

    Ashok,
    I tried this already and it doesnt work too. I am printing both exp and actual and it is same. i am wondering whhy StrCOmp is not seeing this:-(

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

    Re: StrComp giving problem

    Results from print
    expected: No records found
    actual: No records found
    -1

  7. #7
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,613
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: StrComp giving problem

    What does it return if you just do an = comparison?

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

    Re: StrComp giving problem

    I did the following:
    If (trim(cstr(sExpMsg))=trim(cstr(sActMsg))) Then
    Print "equal"
    else
    Print"not equal"
    End If

    It prints Not Equal

  9. #9
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,613
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: StrComp giving problem

    Well then it's not StrComp's fault.

    Put a watch on those expressions and see if you see anything strange at runtime.

  10. #10
    Moderator
    Join Date
    Jan 2007
    Location
    Pittsburgh, PA
    Posts
    2,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: StrComp giving problem

    Did you try with lcase as Suchit mentioned in the post?

 

 
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.40 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.7.1 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.3.0 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 09:17 PM.

Copyright BetaSoft Inc.