check if the cookie has comma

Posted on 2011-04-27
Last Modified: 2012-05-11
I have created a cookie with value,22
  <cfcookie name="User" value=",22" expires="30">  
How can I say if the cookie value has comma then do something else don't do anything

<cfif cookie.User eq "the value has comma">
do something
don't do anything
Question by:lulu50
    LVL 39

    Expert Comment

    <cfif cookie.User contains ",">
      do something
      don't do anything
    LVL 39

    Accepted Solution

    But if you want to find out if there is an actual value on both sides of the comma, you can do this...

    <cfif listLen(cookie.user) gt 1>

    If the value happens to be ...

    "12.345,"   --- there is not value after the comma


    ",12.345"  -- -there is no value before the comma

    using the listLen() function will consider that ONE value,  not TWO

    If you don't care if there is a value on both sides or not, use my first post


    Author Closing Comment

    GOOD JOB!!!!!

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
    Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now