double-quotes

Java - Removing the double quotes in XML attributes

爷,独闯天下 提交于 2019-12-20 07:20:29
问题 I have an xml string which I get via a REST call. However, some of the attributes have corrupted values. For example: <property name="foo" value="Some corrupted String because of "something" like that"/> How can I replace double-quotes either not preceded by value= or not follown by /> with a single quote and get a valid XML string out of that corrupted one in Java 6? EDIT: I have tried to modify this lookahead/lookbehind regex that was used for VisualBasic. But because of the incompatibility

PHP: double quotes don't show in input value, but are shown in normal echo

无人久伴 提交于 2019-12-20 02:36:16
问题 I have some strings in the database like SNEAKERS "SUPER STAR" GOLDEN GOOSE . These are the titles for some products. When I output it normally inside a <p> it shows the quotes, but when I echo it inside an input value, <input type="text" value="<?= $product->title ?"> the string gets truncated before the first double quote, so the value becomes just SNEAKERS . Is there a way I can output the double quotes inside the value of an input ? EDIT: The closing tag was a typo, in the code it is

How to remove all commas that are inside quotes (") with C# and regex

与世无争的帅哥 提交于 2019-12-19 10:05:33
问题 How to build a regex to remove all commas that are inside quotes(") using C# and then substitute them by @? Example : Initial string like this = (value 1,value 2,"value3,value4,value5",value 6) Expected string like this = (value 1,value 2,"value3@value4@value5", value 6) 回答1: You can use string input = "(value 1,value 2,\"value3,value4,value5\",value 6)"; var regex = new Regex("\\\"(.*?)\\\""); var output = regex.Replace(input, m => m.Value.Replace(',','@')); 回答2: string input = "= (value 1

PHP array_map trim + parameters

六月ゝ 毕业季﹏ 提交于 2019-12-19 09:08:11
问题 I'm using array_map to trim all my array values but I need to pass a third parameter because I need to more than just trim whitespaces so I'm passing in a third parameter. Basically I want to trim all array values of whitespaces, single quotes, and double quotes. I have a utility class where I created the function and it looks like this: public function convertToArray($string, $trim = false) { $split = explode(",", $string); if($trim) { $split = array_map("trim", $split, array(" '\"")); }

CSV parsing with Commons CSV - Quotes within quotes causing IOException

我的梦境 提交于 2019-12-19 07:48:47
问题 I am using Commons CSV to parse CSV content relating to TV shows. One of the shows has a show name which includes double quotes; 116,6,2,29 Sep 10,""JJ" (60 min)","http://www.tvmaze.com/episodes/4855/criminal-minds-6x02-jj" The showname is "JJ" (60 min) which is already in double quotes. This is throwing an IOException java.io.IOException: (line 1) invalid char between encapsulated token and delimiter. ArrayList<String> allElements = new ArrayList<String>(); CSVFormat csvFormat = CSVFormat

Manage quotes inside string VBA

♀尐吖头ヾ 提交于 2019-12-18 09:49:08
问题 I trying to insert to Access Table some values that I getting from another table, the problem is that some values comes with quotes and double quotes inside the string, like this example: str1 = "Non-fusible sectionalizing "green' low rise switch." How can I manage quotes inside string in VBA for Access 2010 for can insert it into table? 回答1: From memory I think you just need to double them up to look like this: str1 = "Non-fusible sectionalizing ""green' low rise switch." You can perform a

Is there any difference between “string” and 'string' in Python? [duplicate]

两盒软妹~` 提交于 2019-12-17 18:32:30
问题 This question already has answers here : Single quotes vs. double quotes in Python [closed] (19 answers) Closed 3 years ago . In PHP, a string enclosed in "double quotes" will be parsed for variables to replace whereas a string enclosed in 'single quotes' will not. In Python, does this also apply? 回答1: No: 2.4.1. String and Bytes literals ...In plain English: Both types of literals can be enclosed in matching single quotes ( ' ) or double quotes ( " ). They can also be enclosed in matching

Add php variable inside echo statement as href link address?

↘锁芯ラ 提交于 2019-12-17 10:44:06
问题 I'm trying to use a php variable to add a href value for a link in an echo statement. Here's a simplified version of the code I want to use. I know that I can't just add the variable into the echo statement, but I can't seem to find an example anywhere that works. $link_address = '#'; echo '<a href="$link_address">Link</a>'; Any pointers appreciated. 回答1: Try like HTML in PHP : echo "<a href='".$link_address."'>Link</a>"; Or even you can try like echo "<a href='$link_address'>Link</a>"; Or

json parse error with double quotes

允我心安 提交于 2019-12-17 09:40:01
问题 A double quote even if escaped is throwing parse error. look at the code below //parse the json in javascript var testJson = '{"result": ["lunch", "\"Show\""] }'; var tags = JSON.parse(testJson); alert (tags.result[1]); This is throwing parse error because of the double quotes (which are already escaped). Even eval() won't work here. But if i escape it with double slashes like this: var result = '{"result": ["lunch", "\\"Show\\""] }'; var tags = JSON.parse(result); alert (tags.result[1]);

How to add php tags inside attribute value?

十年热恋 提交于 2019-12-14 02:33:44
问题 I'm trying to write meta keywords dynamically with php, so I have such a code , running in WAMP Server localhost/myfile.php : <meta name="keywords" content="keyword1, keyword2, <?php echo $my_array['index_of_keyword3']; ?> "> well of course it results in this: <meta name="keywords" content="keyword1, keyword2,<?php echo $my_array['index_of_keyword3']; ?> "> So what should I do to get <meta name="keywords" content="keyword1, keyword2,keyword3 "> ? Thanks ! By the way, I know I could do this