Questions tagged [braces]

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.

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

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

  • identify code blocks;
  • create lists and arrays;
  • pass arguments to commands in TeX.
195 questions
-1
votes
1 answer

Calculate algebraic formulas with complete formula braces through a stack

I am trying to calculate algebraic formulas with complete formula braces through a stack. So for example I would have this formula: ((6 ∗ (4+2))+(5−1)). The closing braces being indicators that the stack should stop "reading" and calculate the term…
John_Doe
  • 63
  • 5
-1
votes
2 answers

How to replace () with empty spacein notepad ++

How to replace empty braces ( ) with empty space in notepad++. Thanks
satya
  • 55
  • 1
  • 7
-1
votes
1 answer

PHP - Parse sections between braces from text file

I have the DHCP lease file from my pfSense as a text file and I need to parse some data from this using PHP. To give an example, here is how the file looks like: lease 192.168.15.13 { starts 3 2014/11/12 23:51:05; ends 4 2014/11/13 00:06:06; cltt 3…
Lukas
  • 55
  • 1
  • 1
  • 3
-1
votes
1 answer

Sending curly braces via PHP to mySQL

First of all, I know it's not how it's supposed to be. But the system has been setup like this so I have to try and work with it. I have a column of entries in a mySQL table that look like this {12}-{32} and so forth. 12 is the id of the brand of a…
Jeroen
  • 147
  • 1
  • 1
  • 6
-1
votes
1 answer

GUI unknown error

i keep getting this error message saying Guess.java:205: error: illegal start of expression public String doConversion(String text){ ^ Guess.java:205: error: ';' expected public String doConversion(String text){ …
user3285450
  • 1
  • 1
  • 2
-1
votes
5 answers

C language: if() with no else(): using braces fails

I'm confused on need for braces after IF() expression. When using IF(){...}ELSE{...} I'm used to using braces around both IF and ELSE blocks. But when I use no ELSE block it works with no braces and fails with braces: works: IF()... fails: …
Playing with GAS
  • 565
  • 3
  • 10
  • 18
-1
votes
2 answers

which brace style is better?

I'm a little confused which brace style is better? This one? if ( a > b) { c = d; } or this one? if ( a > b) { c = d; } I'm using the first one because I think it's easy to read, but I found it seems that many experts (or…
lkkeepmoving
  • 2,323
  • 5
  • 25
  • 31
-1
votes
1 answer

What do empty braces mean in Python?

Please have a look at this snippet: import xlrd,spss from xlrd import open_workbook wb=open_workbook('C:/temp/testbook.xls') sheetnames=[] for s in wb.sheets(): sheetnames.append(s.name) Why should I write "wb.sheets()" instead of "wb.sheets"?…
RubenGeert
  • 2,902
  • 6
  • 32
  • 50
-2
votes
1 answer

Why are the curly braces in my Angular app's html code not compiling what is inside of them?

I've just started my adventure with Angular and I've faced a problem. I know that you can create a property in app.components.ts and display it in html code by putting its name into curly braces and it should output the property on the wesite In my…
-2
votes
3 answers

Java regex for inserting text between braces

I have a String a = "stringWithBraces()" I want to create the following string "stringWithBraces(text)" How do I achieve this using regex? I tried this : a.replaceAll("\\(.+?\\)", "text"); But get this : stringWithBraces()
user_mda
  • 18,148
  • 27
  • 82
  • 145
-2
votes
3 answers

Java bracket issue

I think I am missing brackets somewhere but I have been searching for 3 hours and cannot find what is wrong, nor has googling helped me at all. I tried adding end braces/brackets to the if then statements but then I get a bunch of errors. Probably…
Martelmungo
  • 42
  • 1
  • 8
-3
votes
1 answer

Why in programming are the braces not arranged next to the text they enclose?

(12193170: not the same question (or not the right answers for that matter...)) So basically why this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } } And not this: public class…
Emdosis
  • 1
  • 7
-5
votes
2 answers

Export all braces in a String to an array

example: String = "(a(b[}7cv)))" the array should look like this: ["(","(","[","}",")",")",")"] my try: if(s.charAt(i) == "(" ){ //add to array}
Zireal
  • 1
  • 1
-6
votes
1 answer

Code fails when class definition closed

I'm a beginner to Java trying to understand why my program works when it seems like it shouldn't. When I try and compile the code below, I get the error "class, interface, or enum expected" and it points to the brace on the final line of the…
fauxfaux
  • 1
  • 1
-7
votes
3 answers

JAVA curly braces

Receiving a syntax error on my curly braces but no matter how many I close it still gives an error. Can't figure it out. Thank you for any advice on this I am at a loss. I have tried adding more and removing more. I had the count of how many I…
1 2 3
12
13