quotes

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

南笙酒味 提交于 2019-11-28 03:15:35
问题 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"?) 回答1: First of all, some people will say that simple-quoted strings are faster that double-quoted strings ; you

Escaping quotes in velocity template

拟墨画扇 提交于 2019-11-28 02:48:49
问题 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? 回答1: 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

How to create cookie without quotes around value?

痞子三分冷 提交于 2019-11-28 02:03:14
I need to create cookie with e-mail address as value - but when I try to - then I have result: "someone@example.com" but I would like to have: someone@example.com The cookie should be created without double quoted marks - because other application uses it in such format. How to force java to not to add double quoted? Java adds them because there is special char "at". I create the cookie that way: HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); Cookie cookie = new Cookie("login", "someone@example.com"); cookie.setMaxAge

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

核能气质少年 提交于 2019-11-28 00:04:30
问题 This question already has an answer here : paste quotation marks into character string, within a loop (1 answer) Closed last year . 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? 回答1: 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 <-

Difference between single and double quotes in awk

不打扰是莪最后的温柔 提交于 2019-11-27 23:13:39
I have this awk statement: glb_library="my_library" awk " /^Direct Dependers of/ { next } /^---/ { next } /^$glb_library:/ { ver=\$0; next } { gsub(/[[:space:]]/, '', \$0); print ver':'\$0 } " file Basically, I have enclosed the awk code in double quotes so that the shell variable glb_library is expanded. I have made sure to escape the $ character to prevent the shell from expanding $0 . Followed the guidance from here . awk gives me this error: awk: syntax error at source line 5 context is { gsub(/[[:space:]]/, >>> ' <<< I want to understand: Is it legal to use single quotes inside awk ? Why

How to use an environment variable inside a quoted string in Bash

时光总嘲笑我的痴心妄想 提交于 2019-11-27 20:13:24
问题 I've tried various forms of the following in a bash script: #!/bin/bash svn diff $@ --diff-cmd /usr/bin/diff -x "-y -w -p -W $COLUMNS" But I can't get the syntax to correctly expand the COLUMNS environment variable. I've tried various forms of the following: svn diff $@ --diff-cmd /usr/bin/diff -x '-y -w -p -W $COLUMNS' and svn diff $@ --diff-cmd /usr/bin/diff -x '-y -w -p -W ${COLUMNS}' and eval svn diff $@ --diff-cmd /usr/bin/diff -x "-y -w -p -W $COLUMNS" Suggestions? 回答1: If unsure, you

Why are some object-literal properties quoted and others not? [duplicate]

空扰寡人 提交于 2019-11-27 19:21:23
This question already has an answer here: What is the difference between object keys with quotes and without quotes? 6 answers I see this all the time: object literals declared such that some keys are surrounded with quotes and others are not. An example from jQuery 1.4.2: jQuery.props = { "for": "htmlFor", "class": "className", readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", colspan: "colSpan", tabindex: "tabIndex", usemap: "useMap", frameborder: "frameBorder" }; What is the significance of wrapping the first two property keys ( for and class )

How do you strip quotes out of an ECHO'ed string in a Windows batch file?

坚强是说给别人听的谎言 提交于 2019-11-27 19:17:26
I have a Windows batch file I'm creating, but I have to ECHO a large complex string, so I'm having to put double quotes on either end. The problem is that the quotes are also being ECHOed to the file I'm writing it to. How do you ECHO a string like that and strip the quotes off? UPDATE: I've spent the last two days working on this and finally was able to kludge something together. Richard's answer worked to strip the quotes, but even when I put the ECHO in the subroutine and directly outputted the string, Windows still got hung up on the chars in the string. I'll accept Richard's answer since

bash alias command with both single and double quotes

六月ゝ 毕业季﹏ 提交于 2019-11-27 18:27:07
I have this command that does what I want but I can't get to alias it in my .bashrc (note that it uses both single and double quotes): svn status | awk '$1 =="M"{print $2;}' I've tried: alias xx="svn status | awk '$1 ==\"M\"{print $2;}'" And some other common sense combinations with no luck.. I know that bash is very picky with quotes.. So what's the correct way to alias it and why ? Thanks You just need to escape it correctly. alias xxx="svn status | awk '\$1 ==\"M\"{print \$2;}'" EJK Here's something that accomplishes the same thing without using an alias. Put it in a function in your

Removing double quotes from variables in batch file creates problems with CMD environment

血红的双手。 提交于 2019-11-27 17:28:37
Can anybody help with effective and safe way of removing quotes from batch variables? I have written a batch file which successfully imports a list of parameters %1, %2, %3 etc. and places them into named variables. Some of these parameters contain multiple words, and therefor are enclosed in double quotes. > "Susie Jo" (%1) > "Smith Barnes" (%2) > "123 E. Main St." (%3) These %variables are next placed in named variables: > set FirstName=%1 > set LastName=%2 > set ShipAddr=%3 verification of variables is done by echo. echo.%FirstName% echo.%LastName% echo.%ShipAddr% results display as "Susie