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

How to parse out feet and inches from string...

New Here ,
Jan 17, 2007 Jan 17, 2007

Copy link to clipboard

Copied

Hi, I am trying to parse out feet and inches from height (i.e 5'6" or 5'6). I'm not too familar with regular expressions and have been trying to get a solution to this. I was wondering if anyone has any ideas of sample code to do this? I'm using FindOneOf and REReplace right now with no luck.

Thanks so much,
C.
TOPICS
Advanced techniques

Views

540

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 ,
Jan 17, 2007 Jan 17, 2007

Copy link to clipboard

Copied

My first instinct would be to use list functions with quotes as the
delimiter.

<cfset height="5'11""">

<cfoutput>feet = #listFirst(height,"'""")# inches =
#listLast(height,"'""")#</cfoutput>

This is untested, I'm not sure if I got all the quote escaping done just
right, but hopefully that gives you an idea.

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
New Here ,
Jan 17, 2007 Jan 17, 2007

Copy link to clipboard

Copied

LATEST
Hi Ian, thanks so much for your reply, I'll start with this and go from there.

-c

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