Questions tagged [square-bracket]

The symbols "[" and "]", commonly used in programming languages. Please use this tag only if the specific usage of these symbols is a relevant part of the question.

Overview

The square brackets "[" and "]" are special cases of brackets, along with parentheses and curly brackets (or braces) ("{", "}").

Uses

Square brackets have many uses in most programming languages, such as:

279 questions
0
votes
0 answers

Bracket notation elements["name"] randomly turns out undefined where elements.namedItem("name") works

Question Outline I have an HTML page with JavaScript code within, generated via PHP. Normally, the elements["name"] bracket notation works properly, and I can access the named element this way. However, after several maneuvers through the pages, the…
0
votes
2 answers

How to use square brackets for math in Java?

While converting a mathematical formula to Java, I encountered square brackets (I found them in the formula). I don't know what they mean in mathematics, because I'm no math expert, just a 14-year old hobby-programmer (so I've not reached to these…
Daniel Kvist
  • 3,032
  • 5
  • 26
  • 51
0
votes
3 answers

Java: regex to find outer square brackets pairs

I would like to find the content of all the outer square brackets pairs in a string. If an outer pair has an inner pair then it should not be matched separately. For example string: [abc][123][cde[456[aq[]1q1]]] results should…
0
votes
3 answers

is there a way of escaping the [] square brackets in the URL before invoking the Web SErvice API URL call?

All: There is an Bible ASP.NET Web Application that I am implementing. Within the Bible ASP.NET Web Application, I invoke the following Third-party web service API url: https://bibles.org/v2/passages.js?q[]=john+3:1-5&version=eng-KJVA Within in the…
crazyTech
  • 1,379
  • 3
  • 32
  • 67
0
votes
0 answers

StringTokenizing an expression with brackets in Java

I'm doing homework for my data structures class and ran into a snag at a certain point. Basically, I have an expression like (varx + vary*varz[(vara+varb[(a+b)*33])])/55 and I have to store the variables in the equation in either of two…
0
votes
2 answers

matlab: Adding square brackets to all individual numerical values within cell arrays

I wish to add a cell array (Ma) into another cell array. However both needs to be of the same format (individual cells in square brackets). For instance I have an array.. Ma{1,:}.' ans = Columns 1 through 8 '83.6' '85.2' '91' '87.9' …
Cheng
  • 279
  • 3
  • 13
0
votes
4 answers

MySQL - Search for bracket and space in string

I have a database with names required to be in this format: FIRST LAST [ID NUMBER] These names are entered manually and are sometimes entered incorrectly without the second space like this: FIRST LAST[ID NUMBER] My intent is to search for all…
Tim Link
  • 1
  • 1
0
votes
1 answer

How to make a string resembling an array name with double quote in php

I want to make a string variable -namely $myvar whose value may be something like this: $myvar='somename[5]'; and I get the "somename" and "5" from separate varibale: i.e. $name="somename"; $id=5; and finally I want to make $myvar with an…
Ormoz
  • 2,975
  • 10
  • 35
  • 50
0
votes
1 answer

How to write function to extract specific data?

I want to write a function to plot desired model fridgerators' daily price. Here is a mini example with my problem: data <- read.table(header=TRUE,text=' date price model 2012-01-01 100 Frenchdoor 2012-01-01 150 Bottom 2012-01-02 110…
0
votes
1 answer

Square brackets in #define statement

In my C++ code I want to be able to switch between using using arrays and variables, i.e. switch between array[2] and two variables array_0, array_1. However, there are a lot of occurrences of array[2] and I was looking for a way to quick switch…
0
votes
3 answers

PHP truncates parameter name after squared brackets?

If the parameter name of an URL contains squared brackets (no matter if they are url-encoded or not), any following character is ignored by PHP and is not made available to the script (e.g. via $_GET). Example…
0
votes
2 answers

Java // No match with RegExp and square brackets

I have a string like Berlin -> Munich [label="590"] and now I'm searching a regular expression in Java that checks if a given line (like above) is valid or not. Currently, my RegExp looks like \\w\\s*->\\s*\\w\\s*\\[label=\"\\d\"\\]" However, it…
Andy
  • 81
  • 2
  • 6
0
votes
2 answers

List with square bracket and no brackets in Python

I want to know whether both of these are a list or not. In python, are both of these lists? x = [1,2,3] ## and y = 1,2,3 Is y a list?
rchughtai
  • 63
  • 1
  • 1
  • 4
0
votes
2 answers

Square bracket notation to dynamically load library items?

So I've spent an embarrassing number of hours trying to save myself a few minutes and make my code a bit neater, and Google has produced nothing, so now I come crawling to stackoverflow. The problem is with square bracket notation + library…
Helmi
  • 3
  • 1
0
votes
1 answer

PHP post with square brackets not creating array

I have used square brackets in forms a few times, however im stumped as the one i'm working on now using Twitter BootStrap (would that make any difference?) is not sending the data(!) - 12 yrs coding and now i'm asking this silly q. What i could…
FstaRocka
  • 278
  • 1
  • 2
  • 15