Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8801783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:55:23+00:00 2026-06-14T00:55:23+00:00

I do C#, no experince with VB and I don’t have any VB installed.

  • 0

I do C#, no experince with VB and I don’t have any VB installed. I’ve been looking at the code below to understand how it works, could someone take a look at this?

So if I call this method with Cat and cat and don’t pass the optional parameter, does it return true and says Cat and cat are equal?

Public Function AreStringsEqual(ByRef sString1 As String, ByRef sString2 As String, Optional ByVal eCompareMethod As VbCompareMethod = vbBinaryCompare) As Boolean

  If LenB(sString1) = LenB(sString2) Then
    If LenB(sString1) = 0 Then
      AreStringsEqual = True
    ElseIf eCompareMethod = vbBinaryCompare Then
      AreStringsEqual = (InStrB(1, sString1, sString2, eCompareMethod) <> 0)
    Else
      AreStringsEqual = (StrComp(sString1, sString2, eCompareMethod) = 0)
    End If
  End If
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:55:24+00:00Added an answer on June 14, 2026 at 12:55 am

    That’s some weird code. Anyway, the default for the third argument is vbBinaryCompare which means that "Cat" and "cat" will compare unequal. To have them compare equal, you’d need to pass vbTextCompare.

    Now here’s why the code is weird: it’s utterly redundant. You could just call StrComp directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't have too much experience with C# so if someone could point me
I don't have any experience building software for Windows but I have experience with
I don't have an experience with any debugger tools geared towards my language, but
I don't have any experience with SVG but I was hoping to use this
I don't have much experience with Serial I/O, but have recently been tasked with
I don't have any experience writing drivers, but have a decent grasp on architecture,
I don't have any prior experience with Selenium/WebDriver tests. I know that Play supports
I experience a very strange problem and I don't have found any help to
I don't have any experience on using a digital cert. Recently I wrote an
I don't have any prior experience with database, but I have to use it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.