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
3answers
303 views

Parsing and formatting a time two ways (perfectionistic approach)

I'm still not satisfied by the readability of the code. The wanted behavior which would be self descriptive would sound like: "I've two fields; one is for the date and one for the hour. This two ...
2
votes
2answers
92 views

“Nice Angles” - Code Eval challenge

Out of fun, I solved "Nice Angles" challenge on CodeEval in C# 4.0: CHALLENGE DESCRIPTION: Write a program that outputs the value of angle, reducing its fractional part to minutes and ...
5
votes
2answers
52 views

writeln() and format() with variadic templates

I wanted to get better acquainted with variadic templates, so I decide to try to implement a function like D's writeln(), just for fun. ...
7
votes
1answer
133 views

Fully-working alternative to String.format(…)

PLEASE NOTE: The code below has "commented out" code; however, no code is actually commented out!! Check my GitHub link below. I did that solely to highlight the relevant code sections. Code in my ...
3
votes
1answer
17 views

Implementation of *nix ipcalc

I posted a JS subnetting calc before, but I wanted to try a CLI version, so I made this. The parts I'm most worried about are: structure (could I refactor the layout better?) Did I goof any math? ...
3
votes
1answer
45 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
79 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
50 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
116 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
154 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
100 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 ...
10
votes
1answer
164 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
105 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
58 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
84 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
93 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
66 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
115 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
69 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
283 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
109 views
4
votes
1answer
44 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
43 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
132 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
70 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
1k 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
138 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
49 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
77 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... ...
6
votes
1answer
156 views

Auto-Format GPA while typing

I'm looking for a more cleaner and simpler solution to auto-format a text-box field intended only for the user to enter their college Grade Point Average (GPA). Here is my code: ...
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
202 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
276 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
223 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
200 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
127 views

Is this the best way to print dynamic percent value?

Is there any better way of printing it? ...
8
votes
1answer
101 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
99 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
8k 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
67 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
378 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
140 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 ...