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
2answers
144 views

Returning the length of the File in B/KB/MB

The method length() in File returns the length of a file in Bytes, this code transforms that into b/kb/mb as can be seen in the ...
4
votes
1answer
52 views

How much time is left?

rags-to-riches of Convert seconds to hours, minutes and seconds. In that question, BigDecimal was chosen to be the model class, which doesn't seem like a right fit ...
2
votes
1answer
36 views

Implementing SQL function STR

I am writing a piece of code in c# that mimics the behaviour of following SQL function STR in the following case: ...
5
votes
1answer
33 views

Dump hash in columns

I tried to answer the question "How to print a hash in Perl, such that 3 key value pairs are printed on each line?" like this. As I got an uncommented downvote, I'd like to ask: What's wrong with/How ...
6
votes
3answers
87 views

Building a report of DNA sites and chunks

Here is the slow part of my code: ...
6
votes
3answers
326 views

Sample printf implementation

Here is my code for printf() implementation in C. Please share your thoughts for improvements. ...
5
votes
1answer
74 views

Rust language tag implementation

language-tags is my first crate, it is hosted on GitHub and I uploaded it to Crates.io. It parses language tags like en-US into useful parts, like language and ...
0
votes
1answer
38 views

YUIDoc syntax for optionally static constructor

In JavaScript, I wrote a class that can be optionally instantiated with the new keyword, but can also be called statically as well. What is the best way to ...
2
votes
1answer
50 views

Triangled printing

This code prints numbers in a triangled way, such as: 1 12 123 12 1 This is the code: ...
4
votes
2answers
82 views

Get an integer as input and display Pi rounded to that amount of decimal places

I've been writing a program that accepts an integer as input and displays the number Pi rounded to that number. The only issue I see is the fact that the Math.Round ...
7
votes
2answers
56 views

Text centering function in bash

I wanted to center some text in my commandline application, so I came up with this function. ...
3
votes
5answers
629 views

10 green bottles assignment

This code was for a university assignment. It's well passed now so don't be scared of giving me false grades, for example. I was wondering what could be done better, or bits of code that are horribly ...
1
vote
1answer
55 views

Angular filter to format temperature

Below is a basic filter I created with Angular that does temperature conversion. I'd like to get thoughts on how to improve this code from both an Angular perspective and a general JS perspective. ...
1
vote
1answer
57 views

jQuery form with price format [closed]

I have this jQuery form with 4 text inputs. The first one only accepts digits, the second one formats value into 'de-DE' price format accepting 2 decimals, the ...
3
votes
1answer
38 views

Data formatting using string spanning

I would like to know how to make my code better. I'm still a newbie in Android, so any tips are appreciated. The code is an AsyncTask class extender that formats data into a nice looking Spannable ...
4
votes
1answer
49 views

Identicon Generator

I'm just playing with Python, trying to refamiliarize myself with it since I haven't used it in a few years. I'm using Python3, but as far as I know it could easily be Python2 with a change to the ...
3
votes
1answer
45 views

Right-justifying a number with dot leaders

I'm working on a small library to help me format numbers easier as my current project deals with a lot of them. I want to be able to just supply the value, precision, width, and fillchar to a method ...
6
votes
3answers
442 views

Separating digits in an Integer

I was reading a Java book and I came up with this kind of problem and I tried to solve it: Problem: Write an application that inputs one number consisting of five digits from the user, separates ...
2
votes
2answers
102 views

Build a time struct for current time in UTC

I'm learning about time structs. Without assigning either in code or input routines I want the current time. Please help me refactor this, if it should be. This code just tries to make a time struct ...
1
vote
1answer
43 views

type/class __repr__ formatter for Python objects

I am building a list of Python objects that I use fairly regularly that have a length property, (len, 'len') and I was trying to determine the best way to simplify the type/class formatter that the ...
3
votes
1answer
52 views

Input data from file, calculating average by a function

I want to thank you guys firstly for your previous comments and feedback. Really appreciate it. I am learning C with school at the moment, but I plan to be "fluent" in C at the end of august of this ...
1
vote
3answers
165 views

Converting a double to a std::string without scientific notation

Problem I need to convert a double to a std::string which contains no scientific notation and no unnecessary fillers. Using ...
6
votes
1answer
67 views

Having fun with JNI: formatting a number

I attempted some (easy) coding with Java Native Interface. This is what I have: six_pack_Neatifier.h: (autogenerated by javah) ...
3
votes
1answer
38 views

Formatting phone number without knowing locale

I am trying to format supplied phone numbers for a web application. Users in general will be supplying US-based phone numbers, but it is possible for some users to input a phone number from another ...
8
votes
2answers
125 views

ASCII graphic waveform generator

Working on some documentation lately, I had a need to convert a number of asynchronous serial waveforms into ASCII graphics characters. Rather than draw them by hand, I decided to write a program to ...
4
votes
1answer
44 views

Textual representation of a C++ function

I need to create an instance of Show of a somewhat complicated type that represents a C++ function. The "serialization" gives me a Haskell interpretation of the ...
11
votes
3answers
771 views

Printing a pyramid

Can you please review this code to determine if it's good or can be improved? ...
2
votes
1answer
55 views

Format letters into text (similar to how you might have date (D-M-Y) = 10 January 2015)

This is a relatively simple script (basically it's a dictionary containing information on how to edit the input text), but I'm trying to learn to write stuff properly. The commented bit at the top ...
6
votes
1answer
94 views

Automatic flowchart generator

I wanted to see graphically what my programme was doing so I wrote this automatic flowchart generator: ...
2
votes
1answer
49 views

Kernighan & Ritchie - detabbing program

Task (1.20) Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Also, the condition is is not to use pointers and structs ...
1
vote
3answers
55 views

Print input one word per line

I'm doing K&R C Exercises. I could use a code review to see how I can improve my logic. The excercise is: Write a program that prints its input one word per line with ...
3
votes
1answer
42 views

Song search app with dynamic tables

I decided to make a Ruby app to search for songs, which uses the tinysong API. Things got really cryptic and weird in the view. I managed to get dynamic tables that adjust to data length, but I feel ...
4
votes
2answers
105 views

Parse and format data on Google Sheets

This is a script that I use on a Google sheet for parsing data that has been pasted from various other software and getting it into the correct format and columns on another sheet. Data is pasted into ...
4
votes
2answers
75 views

K&R C section 1-20 - removing tabs

1-20 of K&R Exercise 1-20 Write a program detab that replaces tabs in the input with the proper number of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every ...
1
vote
1answer
64 views

Rendering JSON array as a tree

This code is working fine for me, but I want to simplify it. Function parents is defining parents of the tree and children ...
2
votes
2answers
149 views

DFS Undirected Graph

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 this link. This code passes ...
1
vote
1answer
54 views
2
votes
1answer
30 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 ...
7
votes
2answers
267 views

ASCII-fication of playing cards

I am making a small Blackjack game in Python 3. The part of the code I am unsure about is that which allows me to print nice ASCII versions of the card. ...
2
votes
2answers
373 views

Pascal's triangle in PHP

Are there any optimization suggestions? ...
2
votes
1answer
49 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
2k 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
128 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
470 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
256 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
115 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
113 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
407 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
429 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
167 views

Transposing rows and columns for file contents [closed]

This program transposes rows and columns for file contents: ...