Converting involves changing data from one data type or format to another.

learn more… | top users | synonyms

2
votes
1answer
44 views

A function to convert FASTA .txt to a dictionary

I'd like feedback on my function to convert FASTA data to a dictionary in Python. Here's an example of FASTA text: ...
4
votes
3answers
649 views

Turning numbers into text

Here is my program that turns numbers into text. It can be extended to millions, billions, trillions and so on. Please review my code and here is what I expect from the users: Is there any better ...
7
votes
2answers
165 views

Numbers to words

Please review my code ...
5
votes
2answers
181 views

Converting a boolean list to string, and vice versa

I am currently using this to convert a List of booleans to a string ...
6
votes
1answer
92 views

Hexadecimal to RGB conversion

I am trying to convert hex to rgb, and rgb to hex. My current code doesn't seem optimal, and there is an issue with 0's in the hexadecimal. What do you think about the overall quality of this code? ...
4
votes
2answers
93 views

Converting a string to various number formats

I'm working on a set of PostgreSQL helper classes, and am representing each PostgreSQL data type as objects. Instead of creating a class for each number format, I've created a template so the user can ...
3
votes
2answers
64 views

Numbers to Strings in Python part 2

After implementing most of the suggestions from the first question, This is the code I got: ...
10
votes
4answers
492 views

Integer seconds to formated string mm:ss

I have a String like "Time left (XX)" or "You need stay here for (XX)" and int as second. I use those two variables to format ...
8
votes
1answer
103 views

Very simple PostgreSQL ORM in C++ using libpq

I'm working on a set of helper classes for working with libpq in C++ and I want to be able to pass in objects to the helper classes and have them internally represented as strings when sent to the db, ...
6
votes
2answers
73 views

Convert numbers into a textual form

So this was originally inspired by @nhgrif's Int extension for translating integer to plain English, however the code is mainly a port of @rolfl's Converting a number to the text representation; ...
4
votes
2answers
100 views

Numbers to English Strings in Python3

Inspired by the recent surge of questions dealing with changing numbers to their English equivalents (See here, here, and here), I decided to write my own version in Python. ...
8
votes
1answer
114 views

Spell a given number in English

I wrote a program that will take a number from 0 to 999,999,999,999 and spell out that number in English. How could I improve the readability of my code? ...
12
votes
3answers
171 views

SQLConnect - A library for connecting Objective-C/Swift applications to Microsoft SQL Server

The complete SQLConnect library can be found here. The file from which the following method belongs can be found here. At some point I may or may not open questions for reviewing other aspects of ...
5
votes
2answers
114 views

Positive integer to Roman Numeral conversion function

For the past two hours I was searching for a built-in function for converting an integer to an equivalent Roman numeral, but it failed to achieve the target. Hence I wrote my own routine for ...
11
votes
1answer
114 views

Naming numbers in American English

This seems like a popular topic lately, so I took a crack at it. Related questions are Number to Words and Converting a number to the text representation. I used this article as a guideline. The ...
7
votes
2answers
217 views

Converting a number to the text representation

Following along with some previous questions: The @dbasnett original here: Number to Words @nhgrif's here: Int extension for translating integer to plain English I wanted to answer the original ...
14
votes
4answers
107 views

Int extension for translating integer to plain English

This code was inspired by this question: Number to Words ...
10
votes
2answers
199 views

Number to Words

I have to convert positive numbers, that are less than 1000, to words. A quick search didn't find anything that looked good to my eye, so I came up with the following. While I was at it I expanded ...
4
votes
2answers
45 views

Is there a better way to document this or is this good enough?

I finished answering Exercise 3.3.1 of How to Design Programs where: Exercise 3.3.1. The United States uses the English system of (length) measurements. The rest of the world uses the metric ...
4
votes
4answers
519 views

Temperature conversion table

This is another solution for this challenge. Problem statement: In this challenge, write a program that takes in three arguments, a start temperature (in Celsius), an end temperature (in ...
9
votes
1answer
89 views

Refactor VB.NET to C#.Net using Linq

I am rewriting a VB.NET application in C#. I will not subject you to the original code because it's pretty messy. Below is the converted C# code: ...
1
vote
1answer
66 views

Returning information about the result of a file processing, without using output parameters [closed]

As part of a C# class CsvConverter that converts various file types to CSV, I am designing a private class CsvConversionResult. ...
5
votes
2answers
37 views

Convert cardinal abbreviations into full cardinal direction

I'm still learning Ruby and I made the following function to convert "N" or "SE" into ...
6
votes
2answers
172 views

Infix to postfix conversion

I have written a C++ program to convert an infix expression to postfix expression using recursion. I would like to know if it can be improved if possible. Can we improve it by not using a stack? I am ...
6
votes
1answer
87 views

Convert WKT representations of geometries into GeoJson

I am working on a class library in C# to convert WKT to GeoJson. I am getting shapes in WKT out of MSSQL. A lot of the shapes ...
8
votes
5answers
262 views

Convert total minutes into “Hours:minute:seconds” for marathon data

The point of the script below is to read in the 10th column which is the total number of minutes a runner took to finish the marathon and convert it into form of "hours:minutes:seconds". Is there a ...
1
vote
3answers
47 views

Large number to many characters

My goal is to take any size number, and convert it to a string of smaller characters that represent the concatenation of the binary expansion of the number. To illustrate what I am talking about, here ...
5
votes
1answer
62 views

Bi-directional atoi()

I am implementing atoi() by traversing a string from the beginning as well as from the end. Is there anything I can improve? ...
15
votes
3answers
1k views

Converting an IP

I've written a DNS tool in Node and would like to know if there's a better and more efficient way of handling the conversion from an IP to a long. I'm not too good at bitwise just yet and would like ...
5
votes
2answers
90 views

Convert string to multiline text

I made this method that takes any string and transforms it into a multiline text l; each line having the max (character) length specified by the rowLength ...
5
votes
1answer
33 views

Converting the integers to their equivalent string representations

I have the following function which converts an integer (such as 103) to its string representation ("one hundred three"): ...
6
votes
1answer
199 views

Converting any PHP function toString() like in JS

In JavaScript, any function is basically an object on which you can call (function(){}).toString() to get it's underlying code as a string. I'm working on a ...
3
votes
1answer
113 views

Converting from std::wstring to std::string in Linux

I was bothered by inability of C++ to mix cout and wcout in the same program - so I've found this question: Converting between ...
4
votes
1answer
261 views

Convert hex string to byte array

The goal is to convert a hex string to a byte array with the following requirements: \$O(1)\$ additional space apart from input and output. \$O(n)\$ runtime This mostly just prohibits creating a ...
3
votes
1answer
68 views

Displaying TimeSpan as largest interval (with units) - Part II

[This is a follow-up question to: Displaying TimeSpan as largest interval (with units). The code listed here has been refactored since the original question was posed. Please note that the scope of ...
5
votes
3answers
291 views

Displaying TimeSpan as largest interval (with units)

The following method is used in a call center application to display an approximation of remaining time. The call center telephone operator would inform the caller that they could perform their ...
5
votes
6answers
93 views

Readability of JavaScript shorthand for converting strings to numbers with default value

This is perfectly readable code to me, but I'm afraid it may be too confusing to others. What do you think? Note that I'm not interested in validation of the input here (validation will happen long ...
5
votes
1answer
102 views

Generic Converter framework

I find myself frequently converting between formats so I have come up with the following conversion framework: The converter interface surfaces a method to convert from a source type to a target ...
1
vote
1answer
45 views

Optimization of a Qt QByteArray conversion

I wrote a function to convert a hexadecimal string representation (like 0x00) of some binary data to the data itself. How can I improve this code? ...
3
votes
1answer
176 views

Conversion from postfix to infix in C

Just over half way through in K&R, came across an exercise to convert from postfix ("reverse-Polish") notation to infix (standard) notation. Basically I'm posting here to see if there is ...
7
votes
4answers
293 views

Number to words in left to right direction

I have faced one logical question in an interview: If we enter a number it will convert into individual strings and display in same order. Ex: If I enter 564 ...
2
votes
0answers
47 views

Length Conversions

I'm trying to create some helper functions that will allow me to convert from one unit of measurement to another. I eventually will need to be able to do speeds and temperatures as well, but so far, ...
4
votes
3answers
304 views

Converting an integer to binary, hex, and octal

I've started caring about standards and the beauty of my code. I doubt whether I've written it correctly and aesthetically. Can you please judge this simple, exemplary program? I want to know of any ...
2
votes
1answer
98 views

Web service - getting data from SQL and adding to Object

I have created a class called CommandMessages ...
2
votes
3answers
205 views

Python Barcode Generator

I was asked to provide some example code for a job interview and didn't have anything to offer, so I wrote the following function. A barcode generator may seem a bit basic, but there's some logic ...
3
votes
1answer
47 views

Replacing Perisan and Arabic digits

I'm using this function to replace UTF-8 characters representing numbers in text with 'normal' digits. I'm wondering if this is optimized code since this is using two ...
4
votes
1answer
118 views

Program for importing autotask contracts into dynamics CRM 2011

We regularly have to convert a bunch of autotask Contracts to a custom CRM entity because we have employees who don't work in Autotask but need those contracts. I wrote the above code to handle this ...
6
votes
4answers
227 views

Better way to repeatedly use istringstream in “counting minutes” challenge

I was doing this easy challenge "Counting Minutes I" from Coderbyte.com where you just calculate the number of minutes between two given times. The second time is always after the first, although it ...
3
votes
0answers
75 views

Parsing an infix notation expression and converting to reverse polish notation

I'm pretty new to Go, and I do not know the best or idiomatic ways to do most of the stuff, so I'd appreciate feedback on how to make my code better, faster or more idiomatic. My program is a set of ...
6
votes
5answers
178 views

Convert sequence of number into display string

My requirement is to convert a sequence of numbers into a display string as below. Example Input 1,2,3,4,5,7,7,8,8,8,10,15,10,11,12,88,87,86 Output 1-5,7-8,10-12,15,86-88 ...