Get value from CGI string

Participant ,
Dec 15, 2017 Dec 15, 2017

Copy link to clipboard

Copied

I have cgi.path_info that is always formatted like this

/data/show/80865


How do I get the ALWAYS numeric value after show/

For example, in this case, I want to get the 80865 value.

Views

469

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

LEGEND , Dec 15, 2017 Dec 15, 2017
This can easily be done, if you treat the value as a list with / being the delimiter.<cfset variables.thisNumber = ListLast(cgi.path_info,'/') />HTH,^ _ ^

Likes

Translate

Translate
LEGEND ,
Dec 15, 2017 Dec 15, 2017

Copy link to clipboard

Copied

This can easily be done, if you treat the value as a list with / being the delimiter.

<cfset variables.thisNumber = ListLast(cgi.path_info,'/') />

HTH,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 15, 2017 Dec 15, 2017

Copy link to clipboard

Copied

As always, thank you.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 15, 2017 Dec 15, 2017

Copy link to clipboard

Copied

LATEST

Thank you for marking my answer as correct.  I do appreciate it.

V/r,


^ _ ^

BTW.. for anyone who likes complex for the sake of complexity you can use RegEx.

<cfset variables.thisNumber = REmatch("\d+$",cgi.path_info)[1] />

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines