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

Get value from CGI string

Participant ,
Dec 15, 2017 Dec 15, 2017

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.

742
Translate
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,

^ _ ^

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

^ _ ^

Translate
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

As always, thank you.

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

Translate
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