All Questions
Tagged with formatting java
1,280 questions
0
votes
0
answers
63
views
Best way to format based on multiple conditions in a MessageFormat
When using MessageFormat I've noticed it's not easy to use more than one argument as a condition to format text. An example would be placing " and " between two values (e.g. like with ...
-4
votes
1
answer
72
views
Combine LeftPad and Truncate in String.format()
TLDR; 1 String.format(XXX, YYY) or "No this is not supported".
Add if the number is to short leading zero. If the number is to long (longer than 6) cut it.
long number1 = 123456789L;
long ...
0
votes
1
answer
88
views
How do update Spring Boot build.gradle to ensure every developer on team is using google-java-format and some general questions
I added the following dependency to the build.gradle file in my branch.
dependencies {
implementation 'com.google.googlejavaformat:google-java-format:1.24.0'
}
From here, I am confused. How can I ...
0
votes
1
answer
31
views
Is there a way to format a LocalDate to take just the month and year
I have a spring boot app that I want the admin to be able to get the system report based on the month and year selected. System report in this case is the number of sales that was made in the selected ...
0
votes
0
answers
67
views
Appending docx using POI by keep original formatting
I am new to POI.
when I merge more than one docx with same fontFamily (Airal, Calibri, Times New Roman), there is no issue on combined docx. For example, If I have two docx with the same Calibri ...
0
votes
0
answers
825
views
Why does Spotless not break long lines though configured to do so?
We have a Java file with content like this (the "real" code does not matter):
public class Example {
public void doSomething(List<String> list) {
try {
if (...
-2
votes
1
answer
293
views
Print invoice for thermal printer, string formatting issue in javaFX application
I am facing a string formatting issue during printing an invoice. The invoice is not properly aligned as I required.
The code simply generate a invoice bill to the thermal printer. If printer device ...
0
votes
0
answers
46
views
Why are escape characters and formatting markers appearing in my displayed strings?
I have two issues with strings I'm trying to determine a solution for - one is related to formatting markers, and the other is related to escape characters for the "<" and ">"...
0
votes
0
answers
55
views
Configure Visual Studio Code formatting to put arguments in Java functions on new lines
I am using VS Code to write Java code.
How can I make it so that the autoformatting puts each argument in a multi-argument function call on a separate line?
I have tried the Java Formatter Settings, ...
0
votes
0
answers
38
views
How do i fix the white space format for my twoString method?
For my homework, we have to create a list that looks like this.
Employee List:
Amy Williams 6345.00
Ese Nguyen 4231.16
Jacqui Smith 1988.20
Srilatha Patel 525.00
However ...
2
votes
1
answer
1k
views
Neovim configuration setup with none_ls
I'm configuring my none-ls.lua file for neovim right now and I'm trying to to find the best builtin formatting for java. But there are too many different types of java formatting builtins out there. ...
0
votes
0
answers
197
views
How do I get `NumberFormatter` to output parentheses for negative values?
Fairly common usage, one wants negative numbers formatted with parentheses around them instead of a minus sign.
So I tried adding this:
override fun toString(): String {
return ...
-1
votes
1
answer
159
views
Format path with date placeholders
Is there a way to insert date parts into a path containing date formats? I've got an application that should save files into yearly & monthly folders, but I'd rather not hardcode it.
The current ...
0
votes
0
answers
31
views
Print formatting in Java, hard left column, printing full statements [duplicate]
I am not particularly familiar with formatting printing, and I am trying to print information about several shapes. The code I have right now is as follows:
System.out.printf("Box volume: %.2f cu ...
0
votes
1
answer
68
views
Format JavaScript vscode code to be like java in eclipse
I have code formatted like this
subRedirect() {
let features = this.config.get('features')
if (features !== null) {
features.forEach(feature => {
...