Hey Guys,
Probably a simple question, but one I am struggling with all the same.
I know that in PHP you wrap a text string in apostrophes or quotations
- (examples $variable = 'this string' OR $variable = "that string" ).
What I am trying to figure is how to handle a string which contains
both apostrophes and quotations already. Is there a something like
CDATA is for XML?
Thanks
Luke 4 18504
Lucanos wrote:
Hey Guys,
Probably a simple question, but one I am struggling with all the same.
I know that in PHP you wrap a text string in apostrophes or quotations
- (examples $variable = 'this string' OR $variable = "that string" ).
What I am trying to figure is how to handle a string which contains
both apostrophes and quotations already. Is there a something like
CDATA is for XML?
Thanks
Luke
Escape them with backslashes, i.e.
echo 'It\'s a boy!";
echo "He said \"Here we go again!\"";
It's a boy!
He said "Here we go again!"
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On Nov 14, 3:14 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Lucanos wrote:
Hey Guys,
Probably a simple question, but one I am struggling with all the same.
I know that in PHP you wrap a text string in apostrophes or quotations
- (examples $variable = 'this string' OR $variable = "that string" ).
What I am trying to figure is how to handle a string which contains
both apostrophes and quotations already. Is there a something like
CDATA is for XML?
Thanks
Luke
Escape them with backslashes, i.e.
echo 'It\'s a boy!";
echo "He said \"Here we go again!\"";
It's a boy!
He said "Here we go again!"
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Hi Jerry,
Thanks for the reply - I appreciate it.
The backslashing looks easy enough, but what if you are dealing with a
large chunk of text which contains both types of characters? I know I
could manually fo a "find-and-replace" to add backslashes, but is
there any other way?
Once again, I appreciate your help.
Luke
Lucanos wrote:
On Nov 14, 3:14 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>Lucanos wrote:
>>Hey Guys, Probably a simple question, but one I am struggling with all the same. I know that in PHP you wrap a text string in apostrophes or quotations - (examples $variable = 'this string' OR $variable = "that string" ). What I am trying to figure is how to handle a string which contains both apostrophes and quotations already. Is there a something like CDATA is for XML? Thanks Luke
Escape them with backslashes, i.e.
echo 'It\'s a boy!"; echo "He said \"Here we go again!\"";
It's a boy! He said "Here we go again!"
-- ============== ==== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck...@attg lobal.net ============== ====
Hi Jerry,
Thanks for the reply - I appreciate it.
The backslashing looks easy enough, but what if you are dealing with a
large chunk of text which contains both types of characters? I know I
could manually fo a "find-and-replace" to add backslashes, but is
there any other way?
Once again, I appreciate your help.
Luke
For large amounts of text, with or without quotes and apostrophes, try
the heredoc syntax: http://www.php.net/manual/en/languag...syntax.heredoc
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On Nov 14, 3:52 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Lucanos wrote:
On Nov 14, 3:14 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Lucanos wrote: Hey Guys, Probably a simple question, but one I am struggling with all the same. I know that in PHP you wrap a text string in apostrophes or quotations - (examples $variable = 'this string' OR $variable = "that string" ). What I am trying to figure is how to handle a string which contains both apostrophes and quotations already. Is there a something like CDATA is for XML? Thanks Luke
Escape them with backslashes, i.e.
echo 'It\'s a boy!";
echo "He said \"Here we go again!\"";
It's a boy!
He said "Here we go again!"
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Hi Jerry,
Thanks for the reply - I appreciate it.
The backslashing looks easy enough, but what if you are dealing with a
large chunk of text which contains both types of characters? I know I
could manually fo a "find-and-replace" to add backslashes, but is
there any other way?
Once again, I appreciate your help.
Luke
For large amounts of text, with or without quotes and apostrophes, try
the heredoc syntax:
http://www.php.net/manual/en/languag...language.types...
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
Exactly what I was looking for - Many thanks Jerry! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: new |
last post by:
Just wonder how you guys handle the single quatation marks when you
write the value of a text input into SQL server. Thanks!
* * * Sent via DevBuilder http://www.devbuilder.org * * *
Developer Resources for High End Developers.
|
by: Tristan Miller |
last post by:
Greetings.
Do any popular browsers correctly support <q>, at least for Western
languages? I've noticed that Mozilla uses the standard English
double-quote character, ", regardless of the lang attribute of the HTML
document. Will any browsers render German-style quotes or French-style
guillemots for lang="de" and lang="fr", respectively?
Regards,
Tristan
|
by: Sathyaish |
last post by:
This one question is asked modally in most Microsoft interviews. I
started to contemplate various implementations for it. This was what I
got.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* StrReverse(char*);
|
by: Andy Fish |
last post by:
When using databinding, I have gotten into the habit of using single quotes
(apostrophe) round attribute values rather than double quotes because this
allows visual studio to work when there are quotation marks in the
databinding expression. As far as I can tell this seems to be recommended
practice.
However, I just realised that HtmlEncode doesn't encode apostrophes, so if
you do something like this
<a href=......
|
by: |
last post by:
Hi,
How do I trim double quotation mark " in a string? Or, how
do I match pattern if the string has double quotation mark
already like "string"? Thanks in advance.
Hugh
| |
by: MooMaster |
last post by:
After some google searching on the forum I couldn't find any topics
that seemed to relate exactly to my problem, so hopefully someone can
help me out...
I'm running python 2.4.1 on a local Win2K system and doing some
work-related development on an AIX box, and I'm running into a problem
using cx_Oracle to add some information to an Oracle 9.2 table.
I have a table_title defined as a VARCHAR2 data type, and when I'm
trying to retrieve...
|
by: Ryan |
last post by:
Sometimes I have a user who will copy and paste something from Word and it
includes a curly variation of an apostrophe. When this text is displayed
back to the user at a later date (after pulling from the SQL Server DBMS) it
is interpreted as "?" instead.
I would like to replace the curly ones with the normal one, but I have not
had luck with the replace function itself.
Any ideas?
Thanks in advance,
|
by: Ufit |
last post by:
Simple,dumm question - how to include quotation marks in the string?
F.ex. "Data Source=.\SQLEXPRESS;AttachDbFilename="C:\client data.mdf";Integrated Security=True;User Instance=True"
I get syntax error.
Thanks for help
Ufi
|
by: The Bicycling Guitarist |
last post by:
Hi. For many years I have been using " for double quotation marks in
the HTML code, but the opening and closing quotation marks render the same
in my browser.
I'm considering going through and using “ and ” (in pairs as
needed) instead. Are there any *disadvantages* to doing so, besides the time
it will take to make the change?
Thanks.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |