Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011

    Unanswered: Like function problem

    hello everyone,

    I am trying to check each letter of a word if that word doesn't contain (AEIOUY) then I have to append (-way) to the end of the word. Now I have this if statement and it doesn't work:

    If OriginalWord.ToUpper Like "*[!AEIOUY]*" Then
    Label1.Text = OriginalWord & "-way"
    End If
    any suggestion to make it work. I need to append a (-way) to the end of a word that doesn't have (AEIOUY)

    thank you guys


  2. #2
    Join Date
    Nov 2003
    Christchurch, New Zealand
    Is this in classic Visual Basic? Or VB.Net or are you trying to do this in SQL? Assuming you are using VB.Net have a look at these examples
            Console.WriteLine(("DFGHJKL" Like "[AEIOUY]")) 'False
            Console.WriteLine(("DFGAHJKL" Like "*[AEIOUY]*")) 'True
            Console.WriteLine(("EFGHJKL" Like "[AEIOUY]*")) 'True
            Console.WriteLine(("FGHJKLI" Like "*[AEIOUY]")) 'True
            Console.WriteLine(("OFGHJKL" Like "*[AEIOUY]*")) 'True
            Console.WriteLine(("FGHJKLU" Like "*[AEIOUY]*")) 'True
            Console.WriteLine(("DFGHJKL" Like "![AEIOUY]")) 'False
            Console.WriteLine(("DAJKL" Like "![AEIOUY]")) 'False
            Console.WriteLine(("DFGAEKL" Like "![AEIOUY]"))  'False
            Console.WriteLine(("DFARETIWOVUBYJKL" Like "![AEIOUY]")) 'False
    The way the like works with the ! operator and a character list is non-intuative. I would actually recommend doing a check in this manner... which I haven't tested but I think should work
    If (!(OriginalWord.ToUpper Like "*[AEIOUY]*")) Then
        Label1.Text = OriginalWord & "-way"
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts