formatting

Excel CSV - Number cell format

I produce a report as an CSV file. When I try to open the file in Excel, it makes an assumption about the data type based on the contents of the cell, and reformats it accordingly. For example, if the CSV file contains ...,005,... Then Excel shows it as 5. Is there a way to override this and display 005? I would prefer to do somethi...

Recommended HTML formatter script/utility?

Simple question - I've got a bucketload of cruddy html pages to clean up and I'm looking for a open source or freeware script/utility to remove any junk and reformat them into nicely laid out consistent code. Any recommendations? If it's relevant I generally manipulate HTML inside Dreamweaver - but by editing the code and using the wys...

How to format Oracle SQL text-only select output.

I am using Oracle SQL (in SQLDeveloper, so I don't have access to SQLPLUS commands such as COLUMN) to execute a query that looks something like this: select assigner_staff_id as staff_id, active_flag, assign_date, complete_date, mod_date from work where assigner_staff_id = '2096'; The results it give me look something like this: S...

How can I format numbers as money in JavaScript?

I would like to format a price in JavaScript. Basically, I have a float variable, and I'd like to have a function that will receive that variable, and output: "$ 2,500.00" What's the best way to do this? EDIT: OK, since I haven't gotten any answers better than the code I implemented, plus my own answer has been voted down and I can't ...

How do you put { and } in a format string

I'm trying to generate some code at runtime where I put in some boiler-plate stuff and the user is allowed to enter the actual working code. My boiler-plate code looks something like this: using System; public class ClassName { public double TheFunction(double input) { // user entered code here } } Ideally, I thi...

Java: Writing a DOM to an XML file (formatting issues)

I'm using org.w3c XML API to open an existing XML file. I'm removing some nodes , and I'm adding others instead . The problem is that the new nodes that are added are written one after another , with no newline and no indentation what so ever. While it's true that the XML file is valid , it is very hard for a human to examnine it. Is the...

Why do these two date formats differ?

I'm trying to produce just the day number in a WPF text block, without leading zeroes and without extra space padding (which throws off the layout). The first produces the day number with a space, the second produces the entire date. According to the docs, 'd' should produce the day (1-31). string.Format("{0:d }", DateTime.Today); strin...

Formatting a double in JSF

I have a problem similar to the one found here : http://stackoverflow.com/questions/86531/jsf-selectitem-label-formatting. What I want to do is to accept a double as a value for my and display it with two decimals. Can this be done in an easy way? I've tried using but that seems to be applied on the value from the inputText that is...

Formatting a list of text into columns

I'm trying to output a list of string values into a 2 column format. The standard way of making a list of strings into "normal text" is by using the string.join method. However, it only takes 2 arguments so I can only make a single column using "\n". I thought trying to make a loop that would simply add a tab between columns would do it ...

How to display DateTime with an abbreviated Time Zone?

I am aware of the System.TimeZone class as well as the many uses of the DateTime.ToString() method. What I haven't been able to find is a way to convert a DateTime to a string that, in addition to the time and date info, contains the three-letter Time Zone abbreviation (in fact, much the same way StackOverflow's tooltips for relative ti...

VB6 Date Datatype: Precision and formatting

Guys, Does anyone know 1) how precise the vb6 Date date type is (by way of fractions of a second) and how to format it to show fractions of a second. I'm revisiting vb6 after many years absence, and for the life of me can't remember. The things I used to know . . . Thanks P.S. I considered putting a "memory-leak" tag on this, beca...

Storing formatted text in a DB while maintaining abstraction.

How would you store formatted blocks of text (line breaks, tabs, lists - etc.) in a database (nothing specific) to be displayed on the web (XHTML) while maintaining a level of abstraction so that the data can be used in other applications or if the structure of the website were to change in the future? ...

What is the best way for converting phone numbers into international format (E.164) using Java?

What is the best way for converting phone numbers into international format (E.164) using Java? Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number. I am sure I can do it by hand quite easily - but I would not be sure it would work c...

How to format a string as a telephone number in C#

I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable. I was thinking: String.Format("{0:###-###-####}", i["MyPhone"].ToString() ); but that does not seem to do the trick. ** ...

How to format methods with large parameter lists

I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this: public Booking createVehicleBooking(Long officeId, Long start, Long end, String origin, ...

What is your favorite source formatting tool?

We all know that deadlines and/or critical bugfixes and make us forget a bit about source formatting guidelines. Or sometimes you need to work with 3rd party source code which seems to have been coded by someone who doesn't know the meaning of whitespace and readability. What is your favorite tool to tabulate your code (or 3rd party code...

In C#, what is the best method to format a string as XML?

I am creating a lightweight editor in C# and would like to know the best method for converting a string into a nicely formatted XML string. I would hope that there's a public method in the C# library like "public bool FormatAsXml(string text, out string formattedXmlText)", but it couldn't be that easy, could it? Very specifically, what...

Force ASP.NET textbox to display currency with $ sign

Is there a way to get an ASP.NET textbox to accept only currency values, and when the control is validated, insert a $ sign beforehand? Examples: 10.23 becomes $10.23 $1.45 stays $1.45 10.a raises error due to not being a valid number I have a RegularExpressionValidator that is verifying the number is valid, but I don't know how t...

Is there any way to manually fold code in Eclipse?

Is there any way to manually create fold points in code in Eclipse? I know how to enable folding and how to set the auto preferences, but i like being able to set my own fold points so I can ignore certain parts of my code. Think regions in VS. I know there is in VS and NetBeans, but I cannot find a way to set manual fold points in Ecl...

Best JavaScript Date Parser & Formatter?

Since I've started to use jQuery, I have been doing a lot more JavaScript development. I have the need to parse different date formats and then to display them into another format. Do you know of any good tool to do this? Which one would you recommend? ...