Questions tagged [formatting]

1

votes
1

answer
65

Views

How to remove tabs on multiple rows at once

This is not a programming question but an inconvenience in the android-studio editor. If you have an unwanted tab before all your lines, how can you remove them all at once? Now I have to manually go over 50 lines to remove all the tabs to make my code look clean. If you want to add multiple tabs at...
Daan Seuntjens
1

votes
2

answer
60

Views

How do you best format very long string constants in C? [duplicate]

This question already has an answer here: Defining a string over multiple lines 3 answers How to split a string literal across multiple lines in C / Objective-C? 8 answers I have this: char * str = 'hahahahahihihihihohohohohahahahahihihihihohohohohahahahahihihihihohohohohahahahahihihihihohohohohah...
Theo Freeman
1

votes
2

answer
49

Views

How to set a prefix for all print() output in python?

I am printing to a console in python. I am looking for a one off piece of code so that all print statments after a line of code have 4 spaces at the start. Eg. print('Computer: Hello world') print.setStart(' ') print('receiving...') print('received!') print.setStart('') print('World: Hi!') Output...
Dave
1

votes
3

answer
25

Views

Android Dynamic String: %1d vs %1$d

Is there a difference between a format string with the $ included? %1d vs %1$d I noticed that in the app code we have both and both seems to work ok. or by the way using %1d to %2d vs %1$d to %2$d
htafoya
1

votes
2

answer
37

Views

Split number thousand java

I want to split some String by adding some commas in it. For example : '1234' => '1,234' '12345' => '12,345' '123456' => '123,456' '1234567' => '1,234,567' '12345678' => '12,345,678' '123456789' => '123,456,789' I can have such a huge String like '123456789123456789123456789123456789123456789' Curre...
Itoun
1

votes
2

answer
38

Views

Converting the result of NumberFormat.parse() into a BigDecimal

I've defined a formatter like so: >>> import java.text.NumberFormat >>> val formatter = NumberFormat.getInstance() It would appear that the result of formatter.parse('1,000') is a Long: >>> formatter.parse('1,000')::class class kotlin.Long However, if I try to pass it to the constructor of BigDecima...
Kurt Peek
0

votes
4

answer
43

Views

How to add space after inputted Python name, when printing?

I'm a new Python coder, so please take it easy on me and don't get angry when I don't understand. I know this might seem abnormal, but I can't understand what is wrong with this code: name = input('What is your name?') print('Hello'+name) It prints 'HelloJoe' instead of 'Hello Joe', which I am aimin...
1

votes
3

answer
5.9k

Views

Resize div along with content inside according to window size

I have looked up a million techniques and I can't get this to work and I know there is other posts similar to this. I'm sorry if it bugs anyone but I need specific instructions for my code cuz me stupid. Thank you so much in advance! I want the div container contentContactBox, along with all of the...
Edge
1

votes
3

answer
334

Views

How to remove numbering from “lynx --dump -listonly”

$ lynx --dump -listonly index.html Example result: References Visible links 1. http://lynx.invisible-island.net/ 2. http://lynx.invisible-island.net/lynx.html 3. http://lynx.invisible-island.net/current/index.html What I want to do is remove the 1. 2. and 3. 'References' and 'Visible Links' text inc...
1

votes
4

answer
276

Views

How to have an integer in a filename (python)

I am making a code that will create textfiles equal to a number they entered, all named after them. So far i have this name = input('Enter your name') num = input('Enter a number') x = 0 for i in range(1,num): x = x+1 file = open(name(x) , 'w+') lines = ('hi' , name) file.writelines(lines) file....
Oli
1

votes
1

answer
49

Views

Does 'string.format' allow more control over iterables / dictionaries?

I am in a situation where it is easy to adjust the formatting string, but hard to adjust the arguments for format: 'I can influence this'.format(foo={'a': 'no', 'b': 'control'}, bar=['no', 'control', 'either']) For numbers, you can format with {:1.23f}. For dates, you can format with {:%Y-%m-%d}. I...
Martin Thoma
1

votes
3

answer
87

Views

Change color of text in a cell of excel

I would like to change the color of a text in a cell in MS Excel like the conditioned formatting. I have different text in one cell, e.g. 'WUG-FGT' or 'INZL-DRE'. I would like to format the cells (all cells in my workshhet), that a defined text like 'WUG-FGT' appears red and the other text 'INZL-DRE...
JinFins
1

votes
1

answer
44

Views

How to find a Future Date in Java(say two months from today) in 24 February 2019 format

Below is the approach I am going with : Date DateObject = new Date(); SimpleDateFormat formatDate = new SimpleDateFormat('dd MMMM yyyy'); String dateString = formatDate.format(DateObject); System.out.println(dateString); Now this gives me the current date in desired format. I want to find the Value...
Kovid Mehta
1

votes
2

answer
58

Views

C++ Star diamond pattern written to output file becomes jumbled

I am learning to code in C++ and doing simple beginner exercises. Currently, I am facing a problem where my star diamond pattern output's correctly to the console, but that same output to the file becomes jumbled. This program creates a * star diamond based on a row length, and attempts to save that...
Raymond
1

votes
1

answer
31

Views

Unexpected behavior with “git commit .” when pre-commit hook modifies staged files

In my experience git commit -a has had equivalent behavior to git commit . However, recently I have created a pre-commit hook that automatically formats my source code and now git commit . has some unexpected side-effects: the file that is committed ends up as modified in the working directory and i...
Eric Roller
1

votes
3

answer
10.8k

Views

.NET DateTime.ToString() - Default Format Setting

Is the default format of ToString dependent on anything server related? Here's the issue: I'm testing and have tested an application on my local machine and ToString(), by default, is returning in a format of 'MM/dd/yyyy hh:mm:ss tt', however on our server it appears to be returning as 'dd/MM/yyyy...
Wes P
1

votes
0

answer
326

Views

Convert a string in the format dd-mm-yyyy into a date in angular 4

How to convert a string in the format dd-mm-yyyy into a date object in angular 4 expression. Example: Test date : {{testDate | date :'dd-MM-yyyy'}} If testDate = '2005/01/21' then date pipe is working fine. But for testDate = '21-01-2005' , it showing invalid date.
Abinash
1

votes
1

answer
596

Views

Excel 2013: Condition Formatting with “IF(AND)” and “ISBLANK” and Data Validation Values

I have a formatted table and would like to use conditional formatting to shade in cells in a column (G) based on the following conditions: Value in column (D) must say 'Pending Decommission'. The value is from a data validation list. If value does not match, do nothing. If the above is true, then ch...
Thomas Nguyen
1

votes
1

answer
82

Views

Custom Format decimal number as N Week N Day

I have a table of dates that i reference in another table that shows the number of weeks & days elapsed since TODAY().I use the DOLLARFR() function to get a decimal value that represents the weeks & days elapsed. =DOLLARFR((TODAY()-M8)/7,7) Where M8 = '22-Dec-2017' & TODAY() = '29-Dec-2017'. This gi...
sifar786
1

votes
0

answer
62

Views

How to do you make colored bullet points with python-docx?

I am wondering if it is possible to set the bullet point color in python-docx (style= List Bullet) without changing the font color? I know its possible using word but I can't find the attribute to do this via code. Thanks
HollyPocket27
1

votes
0

answer
30

Views

Conditional colorscale - programmatically

I am struggling to recreate logic behind Excel's three-colors scale for conditional formatting. This is the second option displayed when you choose Home-->Conditional Formatting -->Color Scale (red-yellow-green). I have started with this subroutine: Sub Tricolore(Rng As Range) Dim cl As Range Dim d...
MarcinSzaleniec
1

votes
1

answer
1k

Views

Conditional Formatting using Index/Match

I am working on a workbook that has a number of worksheets, and I am trying to apply conditional formatting for a cell one sheet based on the value of a cell in another. I noticed the following phenomenon, for which I don't have a good explanation: In one sheet, I have an array of random numbers bet...
AEStudent51345
1

votes
1

answer
246

Views

Excel VBA loop through cells to find Conditional Formatted cells and copy paste on other sheet

My issue: I want to loop through a range, and whenever it finds a conditional formatted cell, it should copy the cell to the left to the cell to the right of it. And then afterwards paste it into an other worksheet. My code loops through the cells easily, but doesn't copy the information, and paste...
Patrick S
1

votes
2

answer
26

Views

Excel condtional formatting - multipile conditions and search references

I would be very grateful for help with this conditional formatting problem as I'm terrible with excel but learning. I have a large data set which I want to count specific OPCS codes (Classification of Interventions and Procedures). The issue is, that in some rows there are multiple OPCS codes that...
Jimmyjimjams
1

votes
0

answer
49

Views

Use Of Different Locale Values for Different Methods

When I use nextDouble() method of Scanner class like try (Scanner input = new Scanner(Paths.get('input.txt'))) { double d = input.nextDouble(); System.out.printf(Locale.getDefault(),'%.2f',d); } catch (NoSuchElementException | IllegalStateException | IOException e) { e.printStackTrace(); } nextDoubl...
Neophyte
1

votes
0

answer
54

Views

clang-format align postfix types in declarations

Is there any way to align postfix types using clang-format? I have the below options set but it seems to have no effect on declarations in typescript (postfix types) From the Clang 6 documentation: AlignConsecutiveAssignments (bool) If true, aligns consecutive assignments. This will align the assig...
Kyle Abramowitz
1

votes
1

answer
34

Views

formatting combobox elements

In my database serial-numbers are stored as an Integer. I want to represent these numbers in a Access-frontend combobox with a different formation: '121212345' --> '12.12.12345' When a number is chosen it should be stored as an Integer again. I already tried to populate the combobox by myself with s...
daly
1

votes
1

answer
386

Views

Getting caller class name for Formatter [Java Logging with File Handler]

I want to add a FileHandler to my logger. And I am also creating a new Formatter(java.util.logging.Formatter) for my FileHandler In the format method https://docs.oracle.com/javase/7/docs/api/java/util/logging/Formatter.html#format(java.util.logging.LogRecord), is it possible to get the class which...
Ian Lim
1

votes
0

answer
366

Views

AlaSql Rows and Columns formatting when exporting to excel (.xls)

I am using AlaSql version 0.4.2. I am exporting to excel through following way : var mystyle = { headers: true, sheetid: 'Counter Correction', }; //Create XLS format using alasql.js file. var excelHistoricalFileName = 'HistoricalDataExport_' + $rootScope.Park_Name + '_' + $rootScope.turbineName + '...
user1643830
1

votes
0

answer
386

Views

Preserving formatting to Excel using Shiny downloadhandler

I wrote a code that formats to green if the index > 120 and to red if the index is < 80. It works when I view it in web browser. See below. But when I download the data using downloadHandler, the formatting is gone. How I preserve the formatting? Thank you. My code: server.R: function(input, output...
Ketty
1

votes
1

answer
76

Views

SSRS dynamic positioning of tablix

I have four tablix in my report. Tablix 1 always has data. Tablix 2-4 are hidden if they do not have data. If Tablix 1 has data, Tablix 2 does not have data and Tablix 3-4 have data there is a gap in the report where Tablix 2 would have been. How can I close the gap when a tablix is hidden because...
user974061
1

votes
1

answer
65

Views

How to format and truncate numbers when converting XML to XLS (using XSL)

I am converting an XML to Excel XLS with XSL. How can I format the number to be 3 decimal, and truncate ? So, if the number in XML is 101.746789, I want the number in Excel to be 101.746. When I use the below XSL,the number in Excel becomes 101.747. Thank you.
faujong
1

votes
1

answer
91

Views

Bold text while pasting in Gmail composer

I have to copy some text from a plain text file into Gmail's mail composer and make some parts of that text bold. I can obviously boldface those specific parts manually after pasting it to the composer. But is there a way to do this automatically such that when I copy that content to the Gmail compo...
Sagar
9

votes
4

answer
1.6k

Views

str.format(list) with negative index doesn't work in Python

I use a negative index in replacement fields to output a formatted list,but it raises a TypeError.The codes are as follows: >>> a=[1,2,3] >>> a[2] 3 >>> a[-1] 3 >>> 'The last:{0[2]}'.format(a) 'The last:3' >>> 'The last:{0[-1]}'.format(a) Traceback (most recent call last): File '', line 1, in TypeE...
Explogit
1

votes
1

answer
116

Views

Create Tuples out of JSON File

I've been working on parsing a JSON file to make it easier to work with in PostgreSQL and was wondering what the best method would be to parse a JSON dictionary into tuples? For example the lines look like this for the two variables: The first 'attributes': {'RestaurantsTableService': false, 'GoodFo...
mrsquid
1

votes
0

answer
47

Views

Not getting Xml portion in formatted form?

I am trying to create a xml file which is perfectly formatted. It include somethings Element getting replaced later on. The output is not perfectly formatted. xEvent contains a whole xml template form like string Here is the most of the relevant code string c2 = ']]>'; string c = ''; XmlDocument x...
Breathing
1

votes
1

answer
799

Views

formatting the dollar sign and the decimal alignment

Hi I'm new to python and have been playing around on python for a while but I still can't get the dollar sign and the decimal to align. cost=pack*price discount= cost * dis #the percent discount amountdue = discount + cost #how much they owe print(format('Total $', '13'), format(cost,'6.2f')) print...
Jenny
1

votes
2

answer
42

Views

column manipulation with different files

I have a really annoying problem: I have 2 files that I am using, and I need to replace the columns of the original file while keeping its formatting intact. This is the format: HETATM 1 CA LIG 1 38.925 -1.038 -22.754 1.00 0.00 Ca HETATM 2 CA LIG 1 38.509 -0....
mrsphd
1

votes
1

answer
452

Views

Get started with the formatting in Monaco Editor

I am trying to add a formatting to a custom language in Monaco Editor. It seems that we could use monaco.languages.registerDocumentFormattingEditProvider. As an example, I have made a working plunker. Now I want to add a very simple formatting rule to the whole document: add one newline after each...
SoftTimur
1

votes
1

answer
35

Views

Reduce JavaScript Objects into Array of Formatted Objects

I have an array of objects in the format {type: number, sub_type: number} I need to sort them into an array of objects formatted like this { type_id: (type from at least one object in array above), sub_types: [ (all sub types from objects in array above that match this type) ] } This is what I came...
Kurt Petrek

View additional questions