A generic term meaning the process by which text transformed into a more meaningful or clearer output. A typical example would be the transformation of a decimal into a particular currency format with the correct number of decimal places.

learn more… | top users | synonyms

3
votes
1answer
34 views

How to better indent multiline strings with many string formatting args?

I have a function, that is used in flask, for logging application errors: ...
4
votes
3answers
72 views

Validate parameters within a range

Function to use several blocks of if:elif:else: that all take slightly different conditional statements. I'm trying to format integers into a 2 digit string, ...
3
votes
2answers
46 views

Go string formatting

I'm very new to Go, and am trying to get some experience by re-writing some of my Python code in Go. Below is a function that takes an IP address (ipv4) in integer form and returns the string ...
5
votes
1answer
111 views

Simple parsing for string formatting (version 2)

This is my second attempt (version 1) at writing a string formatting utility which uses parsing. This time I more explicitly designed it as a finite state machine. I have very little experience with ...
11
votes
2answers
1k views

A fraction of the code

Following up on this post, and including some major changes suggested, here's the revised code. Changes include: No longer keeping an IFormatProvider at instance ...
10
votes
1answer
150 views

Formattable Fraction

I have written this small little program, to test how my Fraction type behaves when used with and without a custom ...
4
votes
1answer
93 views

Simple parsing for string formatting

Recently I submitted some string formatting and printing code (found here) that I wrote as an small exercise. It was implemented naively using string replacement. This time around I wanted to actually ...
9
votes
1answer
157 views

Did I implement my string formatting code correctly?

As a small exercise I have written some string formatting and printing functions in C++11. I would like a bit of code review, not so much on the merits of using this over something like ...
6
votes
2answers
98 views

Scroll listener - about code style guidelines and standards

I'm an upstart, been only professionally programming for a bit less than 2 years, mainly in Java as I am currently working as an Android developer. I often find myself thinking about how to improve ...
5
votes
1answer
47 views

A Lightweight Rich Link Label

This is my first post here - I hope I don't break any rules.. After reading the same question on SO about how to bold a word in a label for the nth time today, I decided to write a formatted Label. ...
5
votes
2answers
77 views

String representation of a polynomial

We all know that math notation is idiosyncratic. Canonical representation of math objects often have irregular grammar rules to improve readability. For example we write a polynomial \$3x^3 + x^2\$ ...
4
votes
1answer
91 views

Interface and implementation of this replacement for Rebol/Red REJOIN

This is a draft implementation of a function called COMBINE. It's not intended to be a complex formatting dialect, just a replacement for REJOIN that has a better name and more useful behavior. ...
3
votes
2answers
60 views

Java Cross with characters

I managed to make a perfectly even cross with for loops. I'm trying to make this cross easier to code. I have to keep it with ...
4
votes
1answer
112 views

Shell script for creating CR questions

Inspired by Tool for creating Code Review questions. This script generates a markdown document suitable for a CR question from a list of files. For each file it finds, it sends the following to ...
5
votes
3answers
68 views

Command line tools to format tables

I am a big fan of one-liners using sed awk perl and other tools. But there are that are ...
4
votes
2answers
280 views

Shortest possible way of printing a specific board

I am trying to print a board exactly like this with the multidimensional array. char score[10][10] = {' '}; ...
4
votes
3answers
107 views
4
votes
1answer
42 views

Refactor Oxford Comma function (and other functions)

I wrote a program that managed projects and created a set of SQL files for each project. In the logic, I have a few functions that, each time I look at them, I wonder if they could be written in a ...
1
vote
1answer
42 views

Pretty print with unit and physical suffix II

Follow up of Pretty print with unit and physical suffix My first code didn't process negative numbers correctly. Additionally I tried to use all of the helpful input to come up with this solution. I ...
4
votes
1answer
37 views

Code for adjusting linelength

I wrote the following groovy function for taking a string of multiple lines (or any other character for splitting the code into parts), and bringing each line/part to a specified number of characters, ...
4
votes
1answer
60 views

Number formatting

As part of a simple (naive) internationalization attempt in Go, I am trying to come up with a number formatting routine with customizable decimal and thousands separator. Is this approach alright? ...
2
votes
1answer
120 views

A better way to read text files into html?

Currently I'm making a website that has a to-do list that will probably become quite long to write in html. So I decided to make a shorter version for me to write that I find more comfortable to read. ...
6
votes
2answers
68 views

Building shape based on user input

The purpose of the below code is to build a shape based on the user input, specifically: Prompt the user to enter a shape - either a triangle or a square Determine which "texture" to use for the ...
10
votes
5answers
918 views

Vertically placing the words in a string

Please let me know a better approach to solve below problem: Problem: Vertically arrange the words in a string and print on console. Sample Input: Hello Jack ...
3
votes
1answer
126 views

Format string inline

For this project, I do not have access to Boost or C++11. Note: I updated the question's description to clarify what I am doing. I have not changed the code though, so no answer has been invalidated. ...
0
votes
1answer
48 views

Dealing with a dirty table

I have to deal with a really ugly looking response I get back from a particular device. The string represents a table. Each section of the string represents the form: ...
-1
votes
2answers
74 views

Efficient way to sort a formatted array (Chris Pine book, ch 7)

I'm on chapter 7 of Chris Pine's book, trying to work on the last exercise in that chapter. This code works fine, but I'm wondering if there is a better way to do this... ...
4
votes
2answers
164 views

Best way to display big data

I would like to display this data, callable at any time, but I'm not sure if this is the best practice to do so. ...
2
votes
1answer
40 views

Formatting the Lengthy Parameters in a better way

Should I have made a line break convert_to_quick_mode( and from_exported_cdf, ...
10
votes
2answers
200 views

Value formatters (for entities like price, currencies so on)

I am looking over some existing code (see below). The problem of grouping in the same place the presentation logic of some fields (like price, currency) was solved as extension methods on ...
5
votes
2answers
2k views
14
votes
1answer
148 views

Follow-up to tool for posting CodeReview questions

Description This is a follow-up question to Tool for creating CR questions. Things that has changed include: Removed replacing four spaces with one tab, all tabs and all spaces in the code itself ...
21
votes
2answers
260 views

Tool for creating CR questions

To download the tool and for usage instructions, see the follow up to this question Description I have realized that there's a whole bunch of code I want to have reviewed, but copying file by ...
3
votes
3answers
221 views

Any recommendations to improve this logging framework? Or is it overkill?

So I've been kind of irritated with my logging recently as I find myself copying and pasting the same kinds of generic messages around to lots of different methods or retyping them ever so slightly ...
8
votes
2answers
197 views

Tool for automatically correcting indentation and formatting of CR & SO code

This is my tentative solution to How can I prepare my code so that I can paste it formatted? If you need to copy and paste code into the question or answer textarea when solving someone's problem, ...
4
votes
2answers
118 views

Is this the best way to print dynamic percent value?

Is there any better way of printing it? ...
8
votes
1answer
99 views

Number format in JavaScript

What's the best way to format a number? If decimal is less than 2 digits, add zero to make it 2 decimals If more than ...
7
votes
2answers
96 views

Specific PHP Data Access Class

As part of a fun project to help build my knowledge of PHP. I've written a Data Access Class here to bridge the site to the database. I know there are a lot of posts and articles out there explaining ...
21
votes
3answers
1k views

Code indentation for declaring inputs/outputs in an array

I'm writing a list of inputs and outputs for to be compared in unit tests. ...
22
votes
6answers
7k views

“Guess a number” game

I began the journey to be a self-taught programmer about a month ago and my biggest fear about teaching myself is developing bad habits and not realizing it. I'm looking for criticism on this "Guess ...
3
votes
1answer
65 views

How to make this calender program simpler/optimized?

I've made a working calendar program, BUT I believe it's extremely inefficient. I think I have way too many else if statements: ...
3
votes
2answers
353 views

Efficient human readable timedelta

I wanted to write a human readable datetime.timedelta that can be used in log files. Eg, "Report issued 1 hour, 44 minutes, 20 seconds ago" I noticed that casting a timedelta to str() generates ...
2
votes
1answer
132 views

Drawing a table in Python3

I have created a module to draw text tables. The relevant parts are below and here's the full code for txtable). ...
8
votes
2answers
1k views

Printing a diamond of numbers

If you input the number 3 from the keyboard, the program will show this: 0 0 1 0 0 1 2 1 0 0 1 2 3 2 1 0 0 1 2 1 0 0 1 0 0 Here is my ...
1
vote
3answers
112 views

How to format Java code?

I am trying to format my code properly. I have already read the programming standards document and I believe that my code follows these rules. I have also used the Ctrl + Shift + F keys in Eclipse ...
3
votes
2answers
390 views

Shortening and optimizing diamond-printing code

I'm working through a Java textbook by Paul and Harvey Deitel and I have come across a review question (Chapter 2 - Intro to Java, Exercise 2.18 for those that have the book) which asks the user to ...
4
votes
2answers
380 views

A CSharpish String.Format formatting helper

A while ago I implemented .net's string.Format() method in VB6; it works amazingly well, but I'm sure there has to be a way to make it more efficient. I'll start ...
2
votes
2answers
156 views

Implementing an encryption standard over message text

I wrote the below code and tested some example files on it. I didn't find any errors, but I still want to be thorough about this. Also, any suggestions in improving the code? ...
3
votes
1answer
479 views

First Javascript - Geocoder - Can it be improved?

So I'm pretty excited to have coded my first javascript file which now works, and I've spent my evening trying to improve it. It takes a location in the #loc input box and geocodes it (gets ...
2
votes
1answer
105 views

Json whitespace formatter

I couldn't quickly find Java code with googling to make serialized Json easier to read (this is a debugging library, obviously implementation code wouldn't use this as it's just more characters). This ...