how to case select with case-insensitive string ?

Discussion in 'ASP .Net' started by Tee, Jun 23, 2004.

  1. Tee

    Tee Guest

    Hi,

    How to case select with case-insensitive ?

    eg:

    Select Case Textbox1.Text
    Case "Hello" -- ( this will include "Hello", "HELLO", "hElLo" etc etc. )

    Case "Bye"

    End Select

    anyone know how ?


    Thanks.
    Tee, Jun 23, 2004
    #1
    1. Advertising

  2. Try this syntax:

    Select Case Textbox1.Text.ToLower()
    Case "hello"

    Case "bye"

    End Select

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net


    "Tee" <> wrote in message
    news:%...
    > Hi,
    >
    > How to case select with case-insensitive ?
    >
    > eg:
    >
    > Select Case Textbox1.Text
    > Case "Hello" -- ( this will include "Hello", "HELLO", "hElLo" etc

    etc. )
    >
    > Case "Bye"
    >
    > End Select
    >
    > anyone know how ?
    >
    >
    > Thanks.
    >
    >
    Steve C. Orr [MVP, MCSD], Jun 23, 2004
    #2
    1. Advertising

  3. Hi,

    Add Option Compare Text to the top of your file. Simple console app
    example.

    Option Compare Text

    Module Module1

    Sub Main()
    Dim strOne As String = "hello"
    Dim strTwo As String = "HELLO"

    Console.WriteLine(strOne = strTwo)
    End Sub

    End Module


    Ken
    -------------

    "Tee" <> wrote in message
    news:#:
    > Hi,
    >
    > How to case select with case-insensitive ?
    >
    > eg:
    >
    > Select Case Textbox1.Text
    > Case "Hello" -- ( this will include "Hello", "HELLO", "hElLo" etc etc. )
    >
    > Case "Bye"
    >
    > End Select
    >
    > anyone know how ?
    >
    >
    > Thanks.
    >


    --
    Outgoing mail is certified Virus Free.
    Checked by AVG Anti-Virus (http://www.grisoft.com).
    Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004
    Ken Tucker [MVP], Jun 23, 2004
    #3
  4. * "Tee" <> scripsit:
    > How to case select with case-insensitive ?
    >
    > eg:
    >
    > Select Case Textbox1.Text
    > Case "Hello" -- ( this will include "Hello", "HELLO", "hElLo" etc etc. )
    >
    > Case "Bye"
    >
    > End Select
    >
    > anyone know how ?


    In the project properties, set "Option Compare" to "Text", or on
    per-file basis you can add 'Option Compare Text' in the declaration area
    of your file.

    --
    Herfried K. Wagner [MVP]
    <URL:http://dotnet.mvps.org/>
    Herfried K. Wagner [MVP], Jun 23, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guoqi Zheng

    string.indexof case insensitive

    Guoqi Zheng, Jul 9, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    12,888
    bentangle
    Jan 25, 2009
  2. Andrew
    Replies:
    2
    Views:
    1,595
    Mike Schilling
    Aug 15, 2004
  3. =?ISO-8859-1?Q?=22Nils_O=2E_Sel=E5sdal=22?=

    case insensitive string::find

    =?ISO-8859-1?Q?=22Nils_O=2E_Sel=E5sdal=22?=, Oct 19, 2004, in forum: C++
    Replies:
    5
    Views:
    16,666
    Siemel Naran
    Oct 20, 2004
  4. Replies:
    1
    Views:
    2,460
    Mark P
    Apr 6, 2007
  5. Xah Lee
    Replies:
    4
    Views:
    937
Loading...

Share This Page