• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

check if the cookie has comma

Hi,
I have created a cookie with value 10.254.124.523,22
  <cfcookie name="User" value="10.254.124.523,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
<cfelse>
don't do anything
</cfif>
0
lulu50
Asked:
lulu50
  • 2
1 Solution
 
gdemariaCommented:
<cfif cookie.User contains ",">
  do something
<cfelse>
  don't do anything
</cfif>
0
 
gdemariaCommented:
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

or

",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

0
 
lulu50Author Commented:
GOOD JOB!!!!!
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now