?
Solved

Get Last Value from string

Posted on 2011-04-27
5
Medium Priority
?
293 Views
Last Modified: 2012-06-27
Hi,

I have created a cookie with this value:
<cfcookie name="GetIPUser" value="#ipaddress#,22" expires="30">
output
12.176.249.232,22
how can I just get the last value "22" right after the commas.

<cfset NewValue2 = (cookie.GetIPUser) "Note: I just need the value 22 to be here >
<cfset NewValue1 = (cookie.GetIPUser) "Note: I just need the value 12.176.249.232 to be here >
0
Comment
Question by:lulu50
  • 2
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
cfEngineers earned 2000 total points
ID: 35477774
<cfoutput>#listlast(cookie.GetIPUser)#</cfoutput>
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 35477784

Use list last with a . as delimiter

<cfset last = listlast("12.176.249.232.22", ".")>

<cfoutput>#last#</cfoutput>
0
 

Author Comment

by:lulu50
ID: 35477798
cfEngineers:

Great!!!
Thank you
0
 

Author Closing Comment

by:lulu50
ID: 35477803
Thank you Great!!!
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 35477805
sorry misread what you want

<cfset last = listlast("12.176.249.232,22", ",")>
<cfset first = listfirst("12.176.249.232,22", ",")>
<cfoutput>#first#<br>#last#</cfoutput>
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

839 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