Results 1 to 5 of 5

Thread: [RESOLVED] Comma filter

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    138

    Resolved [RESOLVED] Comma filter

    Hello!

    Is there any solution to solve my problem?

    I have string 12.3.2010,13.3.2010,14.3.2010,15.3.2010

    And how to check for example: is 12.3.2010 member of this string up.

    If it is, messagebox ("true")

    If it isn't, messagebox ("false")

    It's important to say that size of the string is not specified, so it can have more dates.

    Thanks!!!

  2. #2
    Hyperactive Member guyvdn's Avatar
    Join Date
    Oct 2002
    Location
    Belgium
    Posts
    336

    Re: Comma filter

    You can do this with the string.contains method. More info: http://msdn.microsoft.com/en-us/library/dy85x1sa.aspx
    To deny our own impulses is to deny the very thing that makes us human

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    138

    Re: Comma filter

    Thank you for link, but problem is: my string are dates separate with commas (,)

    So, how to check is for example 12.3.2010 member of this string:

    11.3.2010,12.3.2010,13.3.2010

    ?

  4. #4
    Hyperactive Member The Fire Snake's Avatar
    Join Date
    Sep 2009
    Location
    USA
    Posts
    401

    Re: Comma filter

    vb Code:
    1. Dim str As String = "12.3.2010,13.3.2010,14.3.2010,15.3.2010"
    2.  
    3.         If str.Contains("12.3.2010") Then
    4.             MsgBox("true")
    5.         Else
    6.             MsgBox("false")
    7.         End If

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    138

    Re: Comma filter

    Yes! That's it.

    I just replaced your constant with variable from textbox and it works perfectly. Thank you very much.

Posting Permissions

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



Click Here to Expand Forum to Full Width