• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

588

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,

^ _ ^

Votes

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,

^ _ ^

Votes

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.

Votes

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] />

Votes

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
Resources
Documentation