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
4 answers

Serializing a dynamic property to JSON

I have a Web API project that hydrates an object defined as the following from JSON. I am attempting to insert this object into a RavenDB database, but am finding that the dynamic property 'Content' is not being serialized properly (note the empty…
ebpa
  • 1,171
  • 1
  • 12
  • 31
0
votes
1 answer

Creating brackets in html issue?

i am making some tournament brackets. for some reason i am having an issue in aligning the logo divs in with the lines of the bracket lines. Can you please help me and tell me how i would position other brackets (in case i add more) Thanks so…
Hunter Mitchell
  • 7,063
  • 18
  • 69
  • 116
0
votes
1 answer

square bracket characters in email address

When we receive a MimeMessage which contains recipient InternetAddresses containing square brackets, we get 'javax.mail.internet.AddressException: Local address contains illegal character in string' when we call MimeMessage.getAllRecipients(). The…
0
votes
2 answers

how to use php's push_array to add a timestamp and value to a two-dimensional array

How can I use array_push to add a timestamp and a value to a two-dimensional array with square bracket syntax? I successfully get rows, each with a timestamp and associated value from a mysql database. While retrieving the results, I add these times…
0
votes
2 answers

Regular expression to grab link between square brackets

I need to lift the YouTube link from some text which looks like this: [youtube=http://www.youtube.com/v/qpbAe2HyzqA&hl=en&fs=1&] Can anyone help?
hitfactory
  • 2,896
  • 5
  • 24
  • 22
-1
votes
1 answer

What is the [][] (double square brackets operator) operator in python?

I am new to python and I was looking for the correct way to do a ternary operation when assigning a variable. I found a post on stack overflow of someone suggesting something like this: var = ['smaller', 'bigger'][7 > 1] where the The value on the…
mijorus
  • 111
  • 1
  • 7
-1
votes
3 answers

How to print a value from a variable in square brackets?

last= "smith" I am trying to print this line: John [Smith]. The answer is last = "Smith" msg = "John" + " ["+ last +"] " print(msg) But I don't understand why the answer is like this. Why do I need the plus signs? Won't the quotation marks in the…
Noob
  • 71
  • 9
-1
votes
1 answer

accessing length of an array inside an object gives me 'TypeError: Cannot read property 'length' of undefined'

I get an error TypeError: Cannot read property 'length' of undefined when trying to access length of an array inside of an object that I get from mapstatetoprops... In my actions folder, i created a function getuserdata that makes an api call and…
F Alem
  • 11
  • 5
-1
votes
2 answers

How to get data in php curl with square brackets query?

I try to get data with libcurl in PHP and my query, value in query, contains query brackets ?conditions[prs_id]=7&conditions[date]=[2019-03-26 TO 2019-04-03]&page=1&limit=1 When I send this with Postman I get object, but with curl i get error 400…
nicram
  • 353
  • 3
  • 7
  • 24
-1
votes
1 answer

What is the purpose of a statement in square brackets after an array push call?

I've been working at a problem on FreeCodeCamp called "9 billion names of God the integer". (The specifics of the problem itself aren't germane to my question, but have a look at the link if you're interested.) Admittedly I wrestled with this…
Matt
  • 123
  • 1
  • 9
-1
votes
1 answer

Annotation passed as a parameter in C# method?

I am looking to use the following method, however it is the first time I come across what is listed as the second parameter of the method. What should go there, what does it mean? Here is the github repository from which the method comes…
lolelo
  • 698
  • 6
  • 18
-1
votes
1 answer

Regex with Javascript getting text between two square brackets

I have some text with several special charakters in it and i want to get the text between the special charakters. I am gogin fin with something like this: === TestText === This works with the regex: /(?:^|\s)=== (.*?) ===(?:\s|$)/g There i get…
Toopf
  • 25
-1
votes
3 answers

How to get the text contains square brackets in square brackets?

I have a string like string str = "[COUNT([Weight] > 10)] < 20 AND [COUNT([Height] < 10)] < 25"; And I want to get the value in square bracket. If I use expression Regex(@"\[.*?\]") => it returns [COUNT([Weight] and [COUNT([Height] but I want to…
-1
votes
1 answer

Java: square brackets when declaring HashMap?

I'm trying to adapt code from here and I can't figure out why they've declared and instantiated their HashMaps using square brackets. Here's some simplified sample code: class CommunityStructure { HashMap[]…
istewart
  • 437
  • 5
  • 18
-1
votes
1 answer

length of array used for html input element's name attribute

This bit of code below appends a div to another div. The former div contains an input element with the name attribute "inputName[]". I'm guessing this is an array that auto-increments as more divs are added. How can I output the length of this…
thanks_in_advance
  • 2,603
  • 6
  • 28
  • 44
1 2 3
18
19