quotes

How can I quote a long string in Perl?

廉价感情. 提交于 2019-12-08 21:01:35
问题 I usually use simple quotes, but sometime I get very long lines which I can't break and also need to use escape characters, so I get something like this: my $str = "select query_accession,query_tag,hit_accession,hit_tag,significance from summaryTables where query_id = \'$query_id\';" I know there are various other ways for representing strings in Perl. What would you recommend? UPDATE Thank you all guys for the SQL-related suggestions. I learn some valuable stuff, but, my question remains (as

How to output a string with a double quotation mark?

老子叫甜甜 提交于 2019-12-08 19:21:38
问题 I need to output a string, which is basically a java code: I have something like this: $web = "...if (url.contains('.mp4'))..." I need that the single quotation mark, will be a double one, and not in html code. Is it possible to do it? 回答1: $new_str = str_replace('\'', '"', $web); You could optional do it by modifying the actual string (note the use of \ to escape the quotation marks): $web = "...if (url.contains(\".mp4\"))..." 回答2: Short of doing a strtr() replacement, just escape your

Ruby Koans: Where are the quotes in this return value?

柔情痞子 提交于 2019-12-08 14:48:48
问题 I'm working on the following Ruby Koan: class Dog7 attr_reader :name def initialize(initial_name) @name = initial_name end def get_self self end def to_s __ end def inspect "<Dog named '#{name}'>" end end def test_inside_a_method_self_refers_to_the_containing_object fido = Dog7.new("Fido") fidos_self = fido.get_self assert_equal "<Dog named 'Fido'>", fidos_self end def test_to_s_provides_a_string_version_of_the_object fido = Dog7.new("Fido") assert_equal __, fido.to_s end The first half of

When should you use single or double quotes in PHP? [duplicate]

烂漫一生 提交于 2019-12-08 14:21:46
问题 This question already has answers here : What is the difference between single-quoted and double-quoted strings in PHP? (10 answers) Single quotes or double quotes for variable concatenation? [closed] (10 answers) Closed 5 years ago . Forgive the bluntness of the question, but I've noticed really you can use either single or double quotes to begin with, along as you follow the suite throughout. Someone once told me to use double quotes when echoing, outputting or returning, and single quotes

How do I pass a quoted string with -D to gcc in cmd.exe?

浪子不回头ぞ 提交于 2019-12-08 14:14:20
With gcc (and possibly other compilers as well) it's possible to define a macro outside the source file like so: c:\MinGW\bin\gcc.exe -DDEFINED_INT=45 foo.c -o foo.exe This will define DEFINED_INT to 45 which can be seen when compiling #include <stdio.h> int main() { printf("The define was: %d\n", DEFINED_INT); return 0; } The compiled foo.exe will then print 45 when executed. Now, what I have no clue of is how do I pass a quoted string instead of an int. So, the printf would then be something like printf("The define was: %s\n", DEFINED_STRING); and the compilation like so: c:\MinGW\bin\gcc

Dumb quotes into smart quotes Javascript issue

北城以北 提交于 2019-12-08 12:42:13
问题 I have some JavaScript code that transforms dumb quotes into smart quotes in a contenteditable . The problem appears when you add dumb quotes at the beginning of the line they only close. For example you get this: ”dumb quotes” instead of “dumb quotes” Try out the demo: http://jsfiddle.net/7rcF2/ The code I’m using: function replace(a) { a = a.replace(/(^|[-\u2014\s(\["])'/g, "$1\u2018"); // opening singles a = a.replace(/'/g, "\u2019"); // closing singles & apostrophes a = a.replace(/(^|[-

-XX:OnOutOfMemoryError=“<cmd> <arg>” gives Error : Could not find or load main class <arg>

╄→尐↘猪︶ㄣ 提交于 2019-12-08 12:27:05
问题 I have set JAVA_OPTS as export JAVA_OPTS="$JAVA_OPTS -server -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:gc.log -Dcom.sun.management.jmxremote.ssl=false -Xms100m -Xmx100m -XX:MaxPermSize=5M -XX:ReservedCodeCacheSize=100m -Xss100k -XX:NewRatio=2 -XX:+UseParallelOldGC -XX:+UseParallelGC -XX:CompileThreshold=100 -XX:HeapDumpPath=/usr/share/$package -XX:-HeapDumpOnOutOfMemoryError -XX:OnError=$TEMP_CMD -XX:OnOutOfMemoryError=$TEMP_CMD" then am running the command "trinidad -p " In $TEMP

Inline style works without quotes

我怕爱的太早我们不能终老 提交于 2019-12-08 07:59:51
问题 I have , for example , this fiddle . You can clearly see I am missing the quotes in the inline-style , but still it does show up correctly . From wherever I have learned , never did they say that not using quotes is allowed . So , is this: A bug in jsFiddle An intended feature . If so , then why we are taught to use the quotes. (Something that you may suggest) Reference Code: index.html <div style=background-color:red></div>This styling is weird stylesheet.css div{ height:500px ; width:500px

Passing a Batch File an Argument Containing a Quote Containing a Space

限于喜欢 提交于 2019-12-08 04:17:57
问题 On many occasions I have dealt with passing batch files arguments with spaces, quotes, percents, and slashes and all sorts of combinations of them. Usually I managed to figure out how to accomplish what I want, but this time I am stuck. I have tried a couple of hundred combinations now and my head is starting to hurt. I’ve reduced the problem to a—fairly—simple requirement: pass from one batch file to another, an argument that contains some space-delimited text, one of which is a quoted space

Why does PowerShell not recognize quoted parameters?

梦想的初衷 提交于 2019-12-08 02:27:35
问题 Why does PowerShell treat quoted parameters differently when you invoke the script directly (in a PowerShell console or ISE) or when you invoke it via another PowerShell instance? Here is the script ( TestQuotes.ps1 ): param ( [string] $Config = $null ) "Config = $Config" Here are the results: PS D:\Scripts> .\TestQuotes.ps1 -Config "A B C" Config = A B C PS D:\Scripts> PowerShell .\TestQuotes.ps1 -Config "A B C" Config = A PS D:\Scripts> .\TestQuotes.ps1 -Config 'A B C' Config = A B C PS D: