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
49 views

Twisting words! (boustrophedon formatting)

I decided to implement properly the Code Golf challenge about twisting strings. I report the assignement verbatim for convenience: Twisting Words! Given a string and a positive integer. You ...
6
votes
1answer
48 views

ANSI colors cross platform

I am trying to write for both NT and POSIX (my two usual platforms) and have come up with the code below. The clrs code I refer to is apparently from blender build ...
6
votes
1answer
55 views

printf-style string formatter

As part of a larger project I'm working on, I've made a function that aims to replicate, as best as I can, the placeholder part of the console.log() function usable ...
2
votes
3answers
135 views

Printing a text rectangle

I'm starting C as my first language and am just under halfway done the book I'm using. However, I commonly hear about 'bad' programmers and 'bad' code whenever I encounter any sort of programming ...
5
votes
1answer
107 views

A custom Pandas dataframe to_string method

Oftentimes I find myself converting pandas.DataFrame objects to lists of formatted row strings, so I can print the rows into, e.g. a ...
2
votes
2answers
71 views

Date formatters, lazily instantiated once

I would like to create two date formatters only on first call. In Objective-C I would use dispatch_once() but now working in Swift. Am I doing it correctly? My code ...
3
votes
2answers
158 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
54 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
39 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
35 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
364 views

Sample printf implementation

Here is my code for printf() implementation in C. Please share your thoughts for improvements. ...
5
votes
1answer
89 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
53 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
84 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
66 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
652 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
82 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
77 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
40 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
53 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
48 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
469 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
104 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
45 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
58 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
261 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
72 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
47 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
146 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
45 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
786 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
123 views

Automatic flowchart generator

I wanted to see graphically what my programme was doing so I wrote this automatic flowchart generator: ...
2
votes
1answer
51 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
56 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
112 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
78 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
72 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
170 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
31 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
343 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
529 views

Pascal's triangle in PHP

Are there any optimization suggestions? ...
2
votes
1answer
53 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
142 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
719 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 ...