Highlighted

How do I edit the text within a Coldfusion string?

New Here ,
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

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

Cheers

Eddie

Views

173

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

How do I edit the text within a Coldfusion string?

New Here ,
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

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

Cheers

Eddie

Views

174

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

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
Reply
Loading...
Jun 01, 2015 0
New Here ,
Jun 02, 2015

Copy link to clipboard

Copied

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

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
Reply
Loading...
Jun 02, 2015 0
Engaged ,
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

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
Reply
Loading...
Jun 01, 2015 0
New Here ,
Jun 02, 2015

Copy link to clipboard

Copied

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

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
Reply
Loading...
Jun 02, 2015 0