square-bracket

List of all unicode's open/close brackets?

你。 提交于 2019-11-26 11:49:41
问题 What is a list of every unicode bracket-like characters (including, for example: {}[]()<> )? What is a good way to search for unicode characters? 回答1: There is a plain-text database of information about every Unicode character available from the Unicode Consortium; the format is described in Unicode Annex #44. The primary information is contained in UnicodeData.txt. Open and close punctuation characters are denoted with Ps (punctuation start) and Pe (punctuation end) in the General_Category

Are square brackets permitted in URLs?

折月煮酒 提交于 2019-11-26 07:41:20
问题 Are square brackets in URLs allowed? I noticed that Apache commons HttpClient (3.0.1) throws an IOException, wget and Firefox however accept square brackets. URL example: http://example.com/path/to/file[3].html My HTTP client encounters such URLs but I\'m not sure whether to patch the code or to throw an exception (as it actually should be). 回答1: RFC 3986 states A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP

PHP Difference between array() and []

半腔热情 提交于 2019-11-26 06:32:21
问题 I\'m writing a PHP app and I want to make sure it will work with no errors. The original code: <?php $data = array(\'name\' => \'test\', \'id\' => \'theID\'); echo form_input($data); ?> Would the following work with no errors or is not recommended for some reason? <?= form_input([\'name\' => \'test\', \'id\' => \'theID\']); ?> Are there any difference? I\'ve looked again the data about array() and the short array method with square brackets [] in PHP.net but I\'m not sure. And also, is the

Does a dot have to be escaped in a character class (square brackets) of a regular expression?

流过昼夜 提交于 2019-11-26 06:00:48
问题 A dot . in a regular expression matches any single character. In order for regex to match a dot, the dot has to be escaped: \\. It has been pointed out to me that inside square brackets [] a dot does not have to be escaped. For example, the expression: [.]{3} would match ... string. Doesn\'t it, really? And if so, is it true for all regex standards? 回答1: In a character class (square brackets) any character except ^ , - , ] or \ is a literal. This website is a brilliant reference and has lots

Accessing arrays by index[array] in C and C++

守給你的承諾、 提交于 2019-11-26 02:56:45
问题 There is this little trick question that some interviewers like to ask for whatever reason: int arr[] = {1, 2, 3}; 2[arr] = 5; // does this line compile? assert(arr[2] == 5); // does this assertion fail? From what I can understand, a[b] gets converted to *(a + b) and since addition is commutative it doesn\'t really matter their order, so 2[a] is really *(2 + a) and that works fine. Is this guaranteed to work by C and/or C++\'s specs? 回答1: Yes. 6.5.2.1 paragraph 1 (C99 standard) describes the