quotes

How to use both single and double quotes inside JSTL/EL expression?

拜拜、爱过 提交于 2019-11-29 14:34:57
I want to call fn:replace inside EL inside c:out to replace quote caracters. The following does not work <c:out value="${fn:replace(userName,'"','\\"')}"/> because XML parser stops at first double quote and sees no c:cout tag termination (JSP compilation stage error). The following <c:out value="${fn:replace(userName,'"','\\"')}"/> does not work, probably because replace function does not see actual quote character. BalusC Parameterize them with <c:set> . <c:set var="search" value='"' /> <c:set var="replace" value='\\"' /> <c:out value="${fn:replace(userName, search, replace)}"/> Unrelated to

sed, foward slash in quotes

若如初见. 提交于 2019-11-29 12:25:10
I'm trying to do something in bash with sed that is proving to be extremely difficult. I have a bash script that takes as its first argument a date. The code want to change a line in a text file to include the passed date. Here's the code #!/bin/bash cq_fname="%let outputfile="/user/cq_"$1".csv";" sed "29s/.*/\"$ct_fname\"/" file1.sas > file2.sas This script fails on the third line, I get something about a garbled command. Does anybody know a clever way to get this to work? How can I get a forward slash in quotes in sed ? You can use any character in place of the / , so just pick one that is

Force repr() to use single quotes

梦想的初衷 提交于 2019-11-29 11:24:58
I have a question, is there a way to "force" repr() to create always single quotes around a string? This happens when I only use repr() print repr("test") 'test' print repr("test'") "test'" print repr("test\"") 'test"' print repr("test'\"") 'test\'"' so the last one actually does, what I want, but I don't want to add always \\" to get the single quotes. Edit: I am not going to mark an answer as accepted since, as pointed out by @martijn-pieters, I was using repr() for purposes it is not intended for. Well, if your object is always a string you could do this: def repr_single(s): return "'" +

Strange behavior of argv when passing string containing “!!!!”

爷,独闯天下 提交于 2019-11-29 11:16:19
问题 I have written a small program that takes some input parameters from *argv[] and prints them. In almost all use cases my code works perfectly fine. A problem only arises when I use more than one exclamation mark at the end of the string I want to pass as an argument ... This works: ./program -m "Hello, world!" This does NOT work: ./program -m "Hello, world!!!!" ^^ If I do this, the program output is either twice that string, or the command I entered previous to ./program. However, what I

Escape Quotes In HTML5 Data Attribute Using Javascript

泄露秘密 提交于 2019-11-29 10:45:43
问题 I'm using jQuery's .data() to work with custom HTML5 data attributes where the value of the attribute needs to be able to contain both single quotes and double quotes: <p class="example" data-example="She said "WTF" on last night's show."> I know using character codes like " in the data attribute value could make the above work, but I can't always control how the values are inputted. Plus, I need to be able to use HTML tags in the markup, like this: <p class="example" data-example=" She said

Should I use php quote escapes for single quotes or use double quotes in arrays?

旧街凉风 提交于 2019-11-29 09:57:24
I realized that I can have problems with single quotes in php arrays: <?php $lang = array( 'tagline' => 'Let's start your project', "h1" => "About Me" ); ?> So I changed it to double quotes: <?php $lang = array( "tagline" => "Let's start your project", "h1" => "About Me" ); ?> Should I use "php quote escapes", instead of what I just did? (by the way how to write "php quote escapes"?) First of all, some people will say that simple-quoted strings are faster that double-quoted strings ; you should not care about that kind of micro-optimization : it will not make any difference for your

Escaping quotes in velocity template

妖精的绣舞 提交于 2019-11-29 09:09:30
I have a java method, that takes a few strings. This method needs to be called from a Velocity Template. However, the strings are too complex, with lots of single quotes, double quotes and commas as well. As a result merge is failing. Is there a way to escape quotes in Velocity? It depends on which version of Velocity you're using. Velocity 1.7 has clear rules for escaping quotes: just double the same type of quotes used to wrap the string: $object.callMethod('Let''s have fun with "quotes"', "Let's have fun with ""quotes""") Prior to that, there were some fuzzy rules with backslash escapes

passing quoted arguments from batch file to `powershell start` - self-elevation on demand

假装没事ソ 提交于 2019-11-29 08:02:52
I am writing a Windows batch file that automatically escalates itself to administrative permissions, provided the user clicks "Yes" on the User Access Control dialog that appears. I am using a technique I learned here to detect whether we already have admin rights and another from here to escalate. When appropriate, the following script, let's call it foo.bat , re-launches itself via a powershell-mediated call to runas : @echo off net session >NUL 2>NUL if %ERRORLEVEL% NEQ 0 ( powershell start -wait -verb runas "%~dpfx0" -ArgumentList '%*' goto :eof ) echo Now we are running with admin rights

Ant, jvmarg, system properties and quotes

可紊 提交于 2019-11-29 07:00:27
问题 We have a property which contains a series of arguments to be passed to the JVM in an Ant script. Example (note the quotes in the second entry): -Dsql.driver=oracle.jdbc.driver.OracleDriver -Dapp.datasource-properties=URL='jdbc:oracle:thin:@//192.168.56.42:1521/xe':User=user:Password=password If I print the content of the variable with the echo target I get the expected result <echo message="${jvm.arguments}"/> produces -Dsql.driver=oracle.jdbc.driver.OracleDriver -Dapp.datasource-properties

How to display text with Quotes in R? [duplicate]

China☆狼群 提交于 2019-11-29 06:49:20
This question already has an answer here: paste quotation marks into character string, within a loop 1 answer I have started learning R and am trying to create vector as below: c(""check"") I need the output as : "check". But am getting syntax error. How to escape the quotes while creating a vector? As @juba mentioned, one way is directly escaping the quotes. Another way is to use single quotes around your character expression that has double quotes in it. > x <- 'say "Hello!"' > x [1] "say \"Hello!\"" > cat(x) say "Hello!" Other answers nicely show how to deal with double quotes in your