Most voted "formatting" questions
Tag used to refer to content formatting in general (field format (date, time, etc), file format, etc).
Learn more…175 questions
Sort by count of
-
31
votes3
answers13759
viewsDifference between %i and %d
Is there any difference between printf("%d", x); and printf("%i", x);? I know the two return the same result, have some kind of convention adopted to always use the %d?…
-
22
votes2
answers574
viewsIs it possible to have month 13 on a date in Java?
I was looking at the class documentation Formatter java 7, this link from Oracle itself, when I noticed myself with the following example below: What intrigued me was the example given for the month…
-
18
votes5
answers22797
viewsHow to invert dates in PHP, regardless of format?
How to invert dates in PHP? I need to invert dates in PHP regardless of the input format, be YYYY-mm-dd or dd/mm/YYYYY.
-
16
votes1
answer3610
viewsWhat exactly is the backslash ( ) for in Python?
I sent an application to Github written in Python that was updated by someone who claimed to have formatted the code properly. After starting to see the changes, I got scared thinking that it had…
-
14
votes1
answer137
viewsRFC6530 - Check if variable contains a well formatted PHP email address
Approval adopted by the Gmail as published in Official Gmail Blog, and as defined in RFC 6530: Assuming a function valida_email() that would return boolean: echo valida_email("té[email protected]"); //…
-
10
votes8
answers7818
viewsCheck if variable contains a well formatted PHP email address
The variable receives a value that is supposed to be an email address, but doubts arise: It will be an email address, random text, or anything else? Being an email address, it is well formatted?…
-
10
votes2
answers49607
viewsHow to format a Datetime field in Brazilian dd/MM/yyyy format?
I would like to format the fields DataAfr and DataTrm of the kind DATETIME, in the Brazilian date format dd/MM/YYYY instead of the American format yyyy-mm-dd hh:mm:ss SELECT e.NmrCnt AS [Contrato]…
-
9
votes1
answer1095
viewsBiometric readers output standard on fingerprint
I would like to know the following questions from someone who has worked with a biometric fingerprint reader: The outputs of biometric readers are standard, ie a reader model A of an X mark follows…
-
8
votes4
answers2315
viewsHow to format a value in Javascript?
What is the simplest way to format the value 1234213412341 for 1234.2134.1234-1 using Javascript? <script> function formatar_valor(strvalor){ var formatado; // formata return formatado }…
-
8
votes3
answers4527
viewsRemove currency formatting and take only the PHP number
i write in the database the values of the products in this way: For example: R$ 5.000,00 How do I do in PHP to make this number stay 5000? That is to say "shape"? Do you have a function that fits…
-
8
votes1
answer128
viewsWhy is Javascript not showing the decimal home number?
The example below normally sample the two zero: console.log(100); But when placing a decimal place or more it does not show: console.log(100.000);…
-
7
votes2
answers57495
viewsFormatting a double in java
I would like to know how to keep the variable double with 2 houses after the comma. Below I have an example, when transforming a String in double if it has values after the point is kept the 2…
-
7
votes6
answers14101
viewsString Format with Javascript
Aiming at the String.Format from C#, which is very easy to use, I searched for something similar to be used in my Javascript codes. I found some rather problematic implementations, aiming at this, I…
-
6
votes3
answers905
viewsProblems with Double formatting
I have a method that gets values like string and performs the conversion to other types, my problem is that when converting an information to double It changes its precise value so that it doesn’t…
-
6
votes2
answers15301
viewsDate formatting with Calendar dd/MM/yyyy
I’m having trouble formatting the date to the dd/MM/yyyy format Como aparece: Sat Feb 26 11:38:28 BRT 2015 Como eu quero que apareça: 04-07-2015 Here’s how I show it on the screen…
-
6
votes2
answers277
viewsDifference Italic and emphasis in HTML?
What’s the difference between tags <i> and emphasis <em> in HTML? When using each of them?
-
6
votes1
answer472
viewsHow to reduce the spacing between printed characters with t in C++?
I wanted to place the columns closer so that it doesn’t happen as in figure 2. int i,j,elemento; for(i=0; i<elemento; i++){ for(j=-elemento; j<=elemento; j++){ if(i >= abs(j)) {…
-
5
votes2
answers3987
viewsDouble formatting in Java
I have the following value 1234.0000. I would like to format to the following output: 1.234,00. There may be cases I’ll use as well 1.234,0, but I believe that making for the first case the others…
-
5
votes3
answers1079
viewsHow to format numbers in Lua?
I would like to know how to format the variable: local n = 100000000 So you can come back like this: 100.000.000 Separated by dots, someone knows how to do?…
-
5
votes2
answers21755
viewsHow to get Date in Day, Month, Year and Time format with Jquery
I have a piece of code that I can get the date and time, but the date is in the format Mês/Dia/Ano followed by time, but precise in format Dia/Mês/Ano followed by the time, I tried to change the…
-
5
votes3
answers12860
viewsHow to fill left zeros in Python?
In php, I know we can fill a number with zeros through the printf Example: printf('%04s', 4); // Imprime: "0004" How could I do that in Python? When I try to do it the way above, the result is not…
-
5
votes1
answer285
viewsFormatting decimal
I’m having a problem formatting decimals in my code in Objective-c, I would like to take advantage only 2 decimal places of my variable which is float. Ex: Value of the variable discount =…
-
5
votes3
answers2129
viewsWhat is the simplest way to create a mask for numbers in PHP?
I have two ways to create masks for numbers in PHP, but I don’t know if it’s the most elegant and effective, so I would like to have some options to improve the code. I need the function to behave…
-
5
votes2
answers728
viewsHow to separate numbers from three to three, backwards, in Javascript, without regular expression?
I already know how separate the numbers from three to three, backwards, with regular expression in Javascript. But I wonder if in Javascript there is a simpler solution, and without the use of…
-
5
votes2
answers1451
viewsI need to know when the user uses semicolons in decimal numbers
I am developing an exercise whose result is different in scenarios that the user uses point or comma to put his decimal number, in this case I put as variable of type double…
-
5
votes1
answer210
viewsWhat is the difference between %p and %d in C language?
Which means the memory address that appears with %p and the %d exactly? What’s the difference? int main() { int teste = 10; int *ptr = &teste; printf("%p\n%d",ptr, ptr); return 0; }…
-
5
votes1
answer73
viewsHow to format a string to add spaces to the right in a printed table?
I am trying to print a table in Java using the method System.out.format, where the exit should be this way: (Dados apenas de exemplo. Não são reais.) SBGR -> BCO | 9,0 m | 5,0 NM | 1400 Ft/m |…
-
4
votes2
answers1760
viewsHow to format monetary values with C++?
I would like to present values formatted as currency, with thousands and cents separators. I would like for example, 56000/12 present 4.666,67. I can present 4,666.67. Would there be some way to…
-
4
votes1
answer1498
viewsHow to replace characters from a String?
I have a small problem. My application receives a numeric string representing a value from the server. But the server sends, for example "100.00" and I need to put a comma in place of that point.…
-
4
votes1
answer113
viewsDoubts about formatting hexadecimal numbers in java for use in MD5
I would like to know why the author of the article put this part: senha = String.format("%1$032X", i); I was curious how he got this string: "%1$032X" Follow the full code: import…
-
4
votes2
answers1829
viewsHow to print a decimal number with a dot, not a comma?
If I do: float a=5; System.out.printf("%d", a); His exit will be: 5.000000 How do I print 5.000000? I mean, I want to replace the comma with the dot.…
-
4
votes3
answers691
viewsHow to correctly format a monetary value?
I have a value that comes from the form that way: R$ 1.500,95 I need him to stay that way: R$ 1500,95 How to turn him into the second way? I need him to look completely the same as the way he was…
-
4
votes2
answers233
viewsWhen I type broken number, it removes the comma and sums as integer
static void Main(string[] args) { Console.Write("Digite sua primeira nota: "); double n1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Digite sua segunda nota: "); …
-
4
votes3
answers857
viewsDollar next to number in Tostring format
When I try to format a value using .ToString("c2") do . NET the symbol of the coin comes stuck with the number. This makes the formatting ugly and wrong to my point of view. Example:…
-
4
votes2
answers184
viewsI cannot format date
I’m trying to format one date to look like another, the first comes straight from the bank but the other needs to be in the same format. Calendar cal = Calendar.getInstance(); SimpleDateFormat df =…
-
4
votes1
answer590
viewsHow to create a mask for Jformattedtextfield?
I am making a program that simulates the Turing machine, and the user fills in a form with the states in this way {q0,q1,q2}. But I want to create mask that the user type only q0q1q2 and the value…
-
4
votes2
answers146
viewsFormat decimal places in Forms
I need to format the decimals and I can’t. What is the correct way to do the formatting in this case? double peso, altura, imc; string nome; nome = txtnome.Text; peso =…
-
4
votes2
answers1473
viewsWhat is the difference between % and % in C?
What’s the difference between using the % and the %% in the C language?
-
4
votes0
answers47
viewsHow to format a cell number in excel for hours type through Openpyxl (Python)?
Whoa, you guys are fine? So, I’m developing a Python test API that when it’s called, it has to return me an Excel file with pre-defined data. One of these data is a time variable that must be…
-
3
votes2
answers1057
viewsHow to format JSON message to read easily
I need to do JSON message DEBUG. I would like one to have available a formatting mechanism similar to the one you have in Eclipse for formatting Java and Javascript code, but via console.
-
3
votes1
answer79
viewsConverting Case to Underscore in Ruby
There is a ready-to-use function that converts Strings to Camel case for strings separated by underscores? I wish something like that: "CamelCaseString".to_underscore return "camel_case_string".…
-
3
votes2
answers93
viewsWhat is the difference between these expressions?
In the srand’s handbook man srand says srand has as a parameter a unsigned int, but when using without cast the compiler does not complain. It has some possibility of going wrong if not using with…
-
3
votes1
answer388
viewsProblem with android conversion
I have a date that’s being returned from a Webservice like this: Sep 22, 2014 12:00:00 AM I would like to convert it to the following format? 22/09/2014 I tried some methods using the Date Android…
-
3
votes1
answer240
viewsAdd tag to all repetitions of a given word
Look at the code below: <style type="text/css"> .format{ color: red; font-style: italic; } </style> <div> <p>texto texto texto 'palavra-chave'. texto 'palavra-chave', texto…
-
3
votes1
answer4689
viewsHow do I create a custom format in a string with Angularjs?
Well I have a date 19102015, if I do so {{step.data | date:'dd/MM/yyyy'}} i can format the date and get 19/10/2015. But in my case, I need something customized. I have a cnpj that comes like this:…
-
3
votes1
answer332
viewsHow to format values with custom string formats?
I am developing a graphic and would like to put the values of the Y axis as the image below: I have verified that it is possible to do this through custom string formats in that way…
-
3
votes2
answers1247
viewsLatex Text Block Formatting
Good afternoon! I am trying unsuccessfully to put this block of text in this photo formatting: How do I do it in Latex? Thanks for your help. PS.: I’m using Texstudio to edit.…
-
3
votes1
answer223
viewsPHP embedded in HTML in Eclipse
Good morning: I’m starting to use Eclipse Ide (Mars) because it already has PHP 7 support while Netbeans doesn’t have it yet. I am facing a problem which is the non-formatting (syntax highlitgh) of…
-
3
votes3
answers917
viewsFormatting String with Dateformat using a Timezone is not working
In my web service, there is an endpoint that returns a timestamp to me UTC and I have a method that generates a date formatted from this timestamp: formatDate(1432313391, "UTC"); public String…
-
3
votes1
answer2505
viewsHow to configure Postgres to accept date in PT-BR format?
Situation Let’s say I have one form in which the user fills a field date, DD-MM-YYYY. Question How can I do the postgres accept this format normally? No need to do to_timestamp('14/06/2016',…