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

1
vote
2answers
27 views

DFS Undirected Graph Code

The code included below was written in response to a programming exercise that was sent to me by a company that I am applying to. The purpose of the code is explained at the following link: ...
1
vote
1answer
49 views
2
votes
1answer
26 views

Printing simple histogram horizontally

I am new to programming and want to know if this is really bad code. I know my variable names may seem arbitrary but I spent some time trying to get them right. I am struggling on that. Would you do ...
2
votes
2answers
66 views

Pascal's triangle in PHP

Are there any optimization suggestions? ...
2
votes
1answer
37 views

Date-filtering function

Please check if this date filtering function is inefficient code. It seems so to me, but I can't figure out the other way around it. ...
11
votes
4answers
1k views

To understand what recursion is, you must first understand recursion

This is the second assignment for my CS2 course: Write a recursive C++ function writeLine() that writes a character repeatedly to form a line of n ...
2
votes
2answers
67 views

Printing a triangle of stars

I've got a rather long function that will take the size of a triangle print it with stars and give the user the option of whether or not they want stars printed inside the triangle, and the ...
5
votes
2answers
102 views

Program to print a triangle of numbers

I want to print the following triangle: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 I tried to do but I cannot avoid two ...
2
votes
1answer
82 views

Producing a pyramid of capital letters

Now I'm reading C Premier Plus by Stephen Prata and there's an exercise 4 in chapter 6 which has no solution in the book, so I can't check if I did it properly. My code works like it should, but I ...
3
votes
4answers
84 views

Formatting MMyyyy to MMyy

The following is my sample code: String month = "09"; String year = "2014"; String monthYear = "092014"; The monthYear format is MMyyyy, I wish to format it to ...
2
votes
1answer
56 views

Formatting a date range, with shortening if the interval falls entirely within a calendar month

The graphic guy wants to display dates like 16. February 17. - 24. February, or ...
2
votes
2answers
160 views

PrettyPrint a Binary Tree (Follow Up)

I have improved the Pretty Printing of binary tree that I implemented previously. In this follow up I have made changes such that every tree is printed (not just a Complete binary tree). Here is my ...
5
votes
3answers
215 views

PrettyPrint a Binary Tree

I was going through this tutorial for Pretty Printing a binary search tree and decided to implement my own version. Here is my implementation. This version works only for trees that are complete ...
1
vote
1answer
67 views

Transposing rows and columns for file contents [closed]

This program transposes rows and columns for file contents: ...
4
votes
1answer
56 views

Sentence formatting

I wrote this function to format a given sentence via Java, and I'm wondering if there is a better way of doing this without use of external libraries, such as with regex. ...
4
votes
1answer
126 views

Convert number into hours : minutes

I wrote a simple extension to convert a number into a hours and minutes string in the ##:## format. This seems like a good way to do it, but let me know what you think. ...
2
votes
1answer
61 views

Text formatting with embedded markup for terminal output

I'm learning Rust. I wrote the following library to format text and output it to terminal, so that the formatting markup is embedded with the string itself (looks similar to HTML4). I feel the code ...
8
votes
1answer
76 views

Create a Christmas Tree

This function draws a Christmas tree (with an angel on top) with text (AKA, ASCII art). ...
4
votes
3answers
530 views

Rounding and formatting hours, minutes, seconds as HH:MM AM/PM

I have a program which is supposed to convert standard time to traditional time. (e.g: 15:24:31 = 3:25PM [rounded seconds]) I would like for someone to error check my code for me as well as give me ...
1
vote
2answers
75 views

Formatting a list of strings as a comma-separated string

I'm learning Haskell on my own and I'm following the material of a course. I would like to know if this is idiomatic Haskell. ...
4
votes
3answers
192 views

Script to generate templated PHP code

I've created a script to create a module in our MVC framework The structure of the module is like this (for this example, the module is called test ...
3
votes
2answers
53 views

Flexible presentation of a user's name based on a combination of available properties

The goal is to add a new displayValue property to each object depending on what it has available out of Firstname, ...
2
votes
2answers
60 views

Function to validate date format

I have this JavaScript function which checks if the format has 'yyyy' and replaces 'yy' with 'y': ...
7
votes
5answers
469 views

Python odd number diamond

I worked up a quick diamond program that takes only odd numbers while returning an error with even numbers or 0. The code looks rather ugly to me, especially with the recurring ...
10
votes
3answers
578 views

Beginnings of a base-conversion game in Python

I'm pretty very new to python, so I thought that I'd write a game to teach me python and better teach me how to think in hexadecimal and binary. I'm starting off by writing a few functions to convert ...
3
votes
3answers
183 views

Padding a hexadecimal string with zeros

I'm given a hexadecimal number in string form with a leading "0x" that may contain 1-8 digits, but I need to pad the number with zeros so that it always has 8 ...
3
votes
1answer
125 views

Convert between two bases, each between 2 and 36

I'm doing some Python practice for fun and I wrote some code that converts between two bases. I'm thinking about expanding on this later, so the docstrings are pretty redundant from function to ...
2
votes
1answer
44 views

Print dict with varying-length lists

Is there a shorter way of taking a dict with varying length lists and printing it to screen? Shortcomings of this method also include that values which aren't lists are printed as letters separated by ...
14
votes
2answers
1k views

Retro Rocket ASCII Art

Inspired by Nested for-loop ASCII art, I looked at building a more complicated ASCII art than just the normal 'diamond' and 'triangle' variations that crop up occasionally here. The challenge: ...
7
votes
3answers
100 views

Calendar Print Method

I'm currently learning Ruby and need help in editing code to be more idiomatic. I have the method below I could use some pointers on how to make more "Ruby" :-) ...
8
votes
4answers
523 views

Align Strings for Output

I wrote a class which can format input so that it is properly aligned. I'm interested in all suggestions (regarding structure, usability, style, naming, comments, etc). I'm especially wondering ...
7
votes
3answers
258 views

Validating lines in a file using certain specifications

I have written a program which basically reads a file named "data.txt" line-by-line. As a line is read, it validates the line with a certain specification. If the specification is met, it will ...
0
votes
1answer
120 views

Round division to two decimal places [closed]

I'm working on a revision of my electrical calculator. I used string formatting to round the answers it gives to two decimal places. On the operations that require multiplication (voltage, wattage), ...
3
votes
1answer
48 views

Format a number to include commas

This is my attempt to format a number and put commas where appropriate. I was wondering if this could be done in a simpler way. It's used by calling ...
3
votes
3answers
349 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
205 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 ...
2
votes
0answers
26 views

sprintf for a microcontroller [closed]

I'm currently writing some code to running using a small micro controller, and need to implement a version of sprintf (the standard library version is too large). I ...
6
votes
2answers
129 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
252 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
79 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
99 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
135 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
62 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
189 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
244 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
190 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
239 views

String-formatting and printing functions

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
127 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
151 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. ...