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

6
votes
1answer
29 views

Convert data back-and-forth between CSV files and pretty-print

I wrote a script to convert CSV files in human readable format and vice versa. Human readable format is achieved like so: ...
0
votes
2answers
32 views

JLabel formatting on GPA calculator

I am currently working on a GPA Calculator side project over holiday break to become more familiar with Swing, but I find the number formatting is more complicated than in regular Java. At the moment ...
15
votes
2answers
303 views

K&R 1-21 write an “entab” program

From K&R exercise 1-21, Write a program entab that replaces strings of blanks by the minimum number of tabs and blanks to achieve the same spacing. Use the same tab stops as for detab. ...
11
votes
4answers
467 views

Function to format the local time

This is a statement that I use a lot in my code base: (LocalDateTime.now()).format(DateTimeFormatter.ofPattern("ssmmHHddMMMuu")) Should I create a static method ...
3
votes
3answers
554 views

Format of hexeditor

Is there a cleaner way to write this code? It's the start of a hexeditor I'm creating. I'm aware that the variables aren't descriptive, this is just a test run for when I imbed it into a File ...
2
votes
2answers
31 views

Parsing users from a list of commands for email notifications

I want to make a list of the last words on each line of a file that looks like this: ...
3
votes
2answers
47 views

Print multiplication tables

Write a function that given a max argument will print a nicely aligned multiplication tables, for example, if max = 8 ...
4
votes
1answer
53 views

String formatting of unit types

I have a units of measure library that I added string formatting to. Here is sample code: ...
4
votes
6answers
155 views

Centering a line of text

I need a procedure that "centers" a string inside a string that is consecutive characters of a fixed length. For instance, ...
7
votes
1answer
50 views

Function to wrap words in a text editor without breaking them

These are 3 functions I created in C language to read in a text file, remove the carriage returns from it in order to display on the screen, and display the file on screen wrapped with the words of ...
3
votes
1answer
55 views

Formatting “Bond, JAMES (Mr)”

I need to call this function over a big dataset. I need it to be as efficient as possible but still be readable. Can I make it anymore efficient by using a different function for capitalize or blank ...
2
votes
1answer
41 views

Printing polynomials

I am taking a class on ruby and our assignment is to take user input and print out a polynomial. Wondering if I can get any feedback to how to improve my code. ...
2
votes
3answers
34 views

Perl code that breaks a line after fixed number of columns

Here is a simple program that I created to print a file by breaking it after a fixed number of columns. I feel it can be optimized but not sure how. Any feedback is great. ...
7
votes
5answers
508 views

Normalizing `DateTime` values to strings

I have this as part of a project to normalize DateTime values to more readable strings, localized to the relative time in the past that they happened. It allows ...
1
vote
2answers
75 views

Number to german decimal format converter function [closed]

I have a function that formats a number (even a float) to a German decimal format. I got this function from here ...
2
votes
1answer
53 views

A Scala script for beautify scientific notation strings from Excel

Excel renders scientific notation in the engineering fashion, e.g. “4.2E-5”. That’s OK, but when you are writing a scientific paper, it’s likely that you want it to look like this: “4.2×10⁻⁵”. I have ...
2
votes
2answers
74 views

Updating a clock display with the time

Originally, I was going to post a question about how to condense four repetitive functions into a single function, but I wound up figuring it out myself before I could even post it. However, the ...
5
votes
1answer
45 views

Using changeable column formatting to display table

When answering python tuition calculator v2, I got a little carried away, and started building a print_table() function which I don't like the resulting code for, ...
3
votes
2answers
51 views

Aligning text in Haskell

This Haskell program just aligns the text lines on the given substrings. I took inspiration from here, but my code is not golfed. ...
7
votes
1answer
147 views

Replacement string Base64 (and a Base32) conversion [closed]

This provides (my own) implementation of ToBase64String and FromBase64String (since the .NET implementations suck), and a ...
1
vote
0answers
71 views

Parse a plain text newsletter and show it with nicer markdown formatting

I wrote some code to parse an e-mailed events newsletter I'm on and redisplay it with better formatting. I like the output, but I'm not thrilled with the code. It feels like there's a lot of ...
8
votes
1answer
65 views

Stream manipulating indenter

I've always wanted to be able to steer stream indentation, so that I could write code like this: ...
3
votes
1answer
108 views

Phone number format and data entry restriction

I created a form that formats phone numbers, allows only allowable keys to be pressed, and converts a lettered entry into its corresponding phone keypad number. Is there some cleanup or better coding ...
2
votes
1answer
31 views

Significant Figures Formatting.00

I wrote this for an SO question on formatting numbers to specific quantities of significant figures (after all, reinventing-the-wheel), anyway, all critiques welcome. It's pretty easy to use, ...
3
votes
1answer
61 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
149 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
105 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
147 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
406 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
101 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
192 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 ...
5
votes
1answer
68 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
52 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
41 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
90 views

Building a report of DNA sites and chunks

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

Sample printf implementation

Here is my code for printf() implementation in C. Please share your thoughts for improvements. ...
10
votes
1answer
160 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
54 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
62 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
97 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
153 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
808 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
353 views

Angular filter to format temperature

This 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 and general JS perspective. The filter should ...
1
vote
1answer
156 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
46 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
74 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
51 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
885 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
116 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
51 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 ...