Re: How to handling string contains single quote and double quote



On Apr 28, 1:41 pm, vikrant <vikrant.kan...@xxxxxxxxx> wrote:
Hi,
I facing a problem in saving a string contains single and double quote
into a file .The string look like the following:-

Example:-
Developer's community "com.lang.perl"
--------------------------------------------------------
The part of Code is:-

#!/bin/perl -w
use strict;

my $Date="10-09-2007";

system("echo '$Date;$String_Value' > data.txt");
----------------------------------------------------------------------------------------
Here,the $String_Value Variable store the string which i have
mentioned above.

I cannot put the slash( \ ) before the double quote's because in my
case value of input string is dynamic.
Also,I know putting a slash before double quote do not solve my
problem because single quote is left which will create the problem.I
get to know about this when i put slash before the double quote's.

The error coming on screen is:-
------------------------------------------------------------------------------------------------
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
-----------------------------------------------------------------------------------------------------

So,please tell me how do i handle this type of input.
I apologize if someone already asked this question earlier.

Thanks and Regards,
Vikrant


Sorry for the Subject line mistake it should be something like
following:-
How to handle the string contains single quote and double quote

.



Relevant Pages

  • Re: Difference between and : symbols
    ... lisp> ... You can inhibit evaluation with the special operator QUOTE. ... The specific thing that confused you is why ASDF functions ... But what ASDF really wants is a string. ...
    (comp.lang.lisp)
  • Re: fastest way to change case of string
    ... string rather than concatenating a new string is indeed much faster. ... Dim quoted As Collection ... Const QUOTE = "'" ... ChangeCaseX = StrConv ...
    (microsoft.public.vb.general.discussion)
  • MD5 Hash with single quote = grief in dao.findfirst
    ... I know when you need to create a query string and the data contains a single ... quote, you must double the quote as an escape sequence. ... Hundreds of assumption cells combined into one 16 character Hash. ... I build the criteria SQL string. ...
    (microsoft.public.access.modulesdaovba)
  • Re: How to handling string contains single quote and double quote
    ... I facing a problem in saving a string contains single and double quote ... Also,I know putting a slash before double quote do not solve my ... file for writing in Perl, and print the line to the file in Perl. ...
    (comp.lang.perl.misc)
  • RE: VBA, and SaveAs Function
    ... The type mismatch comes about in the Str functions in your SaveAs line; ... you're passing a string to a function that expects a number. ... > I have been creating a quote module for the project managers at my lab, ... > save to a unique file, and I am up against a wall. ...
    (microsoft.public.excel.programming)