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

How do I edit the text within a Coldfusion string?

New Here ,
Jun 01, 2015 Jun 01, 2015

Copy link to clipboard

Copied

Hi! I have a ColdFusion variable which contains a URL:

For example, it looks like <iframe width="640" height="360" src="//www.youtube.com/embed/XXXXXX" frameborder="0" allowfullscreen></iframe>.


What I'd like to do is replace the width of "640" with that of "450" and the height of "360" with "253". I'm passing a string into an "if" statement which will change the variables if the conditions are met. I CANNOT change the variables before making it a string. I must change the variables.


What is the best way to do this in ColdFusion? I don't know this language (my expertise is more in JavaScript and PHP), so I appreciate all the help you could give me.


Thank you for your help!


BP

Views

288

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

Advocate , Jun 01, 2015 Jun 01, 2015

Have a look at the Replace() function. It allows you to replace one substring with another.

Cheers

Eddie

Votes

Translate

Translate
Advocate ,
Jun 01, 2015 Jun 01, 2015

Copy link to clipboard

Copied

Have a look at the Replace() function. It allows you to replace one substring with another.

Cheers

Eddie

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 ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

LATEST

Thank you very much! The Replace() worked just fine.

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
Engaged ,
Jun 01, 2015 Jun 01, 2015

Copy link to clipboard

Copied

Can you share the code you are working with?  It is a hard question to answer when we don't know the context.

Thanks,

--Dave

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 ,
Jun 02, 2015 Jun 02, 2015

Copy link to clipboard

Copied

Thank you very much! The Replace() worked just fine.

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