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

learn more… | top users | synonyms

7
votes
1answer
60 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
62 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
31 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
118 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
46 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
248 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
56 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
71 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 ...
4
votes
1answer
20 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
171 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
92 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
114 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
63 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
290 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
89 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
89 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
36 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
70 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
282 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
46 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
189 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
86 views

Web service - getting data from SQL and adding to Object

I have created a class called CommandMessages ...
2
votes
3answers
165 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
39 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
98 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
211 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
67 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
165 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 ...
6
votes
1answer
113 views

Binary converter and sufficient tests

I just finished writing a basic binary conversion class in Ruby. I'm curious to see if anyone has suggestions for improvements. In particular, I'm looking for the cleanest, shortest, most succinct ...
6
votes
1answer
180 views

BBCode to HTML converter using functional programming

I was inspired to write a BBCode to HTML converter as I'm currently learning functional programming. I wanted achieve functional cohesion. jsFiddle I'd like feedback on: structuring of the code. ...
3
votes
1answer
55 views

Infix to postix conversion

I'm looking for code review, optimizations and best practices. Also verifying complexity to be O(n), where n is the string length. ...
12
votes
7answers
634 views

Class for handling unit conversions

I am creating a class to be the end all defacto class for handling unit conversions. This is particularly difficult in my company's industry where imperial architectural strings are used as units. I ...
1
vote
1answer
233 views

Milliseconds to Time string & Time string to Milliseconds

Fast Time conversion I'm trying to write a very fast time-to-string and string-to-time function. I noticed that on low CPU mobile devices this function has, even if minimal, impact on the ...
12
votes
3answers
361 views

Celsius → Fahrenheit conversion table

It's harder to do than criticize. Here's my attempt to implement a Celsius-to-Fahrenheit conversion table in C++. ...
5
votes
1answer
122 views

Convert a mediawiki to dokuwiki script

I have quickly wrote a Perl script to convert a mediawiki to a dokuwiki. I know there's an existing script to make that, but I would have a simpler usage code and some use of the API from mediawiki. ...
3
votes
1answer
56 views

Converting float from arbitrary base to arbitrary base

I needed to write a small program to convert floats from any base to any other base. The thing is, it got big. I know there are other ways to implement the conversions (such as doing subtractions ...
5
votes
2answers
274 views

Hex file converter

I have written a C# file reader that reads a file converts the bytes of the file to hex and writes it out to another file. It works fine but it takes 7.2GB of memory when converting a 300MB file. ...
6
votes
2answers
385 views

Number-to-word converter

My code works, but the aesthetic of the code seems to need some real work. The logic is simple enough: create three lists of words that will be used throughout the conversion, and create three ...
4
votes
1answer
141 views

RGB to HEX (and vice versa) converter

Please review the code. ...
5
votes
1answer
219 views

Converting between Fahrenheit and Celsius

I'm learning Ruby and working through some exercises. I completed the following exercise without truly understanding why and how it works. I know that's an embarrassing thing to say but I feel like my ...
6
votes
3answers
361 views

Binary string to integer and integer to binary string

I am working through K&R for review and I thought that I would write some of my own routines for conversion of binary strings to int and int to binary string. I realize this is reinvetning the ...
12
votes
7answers
773 views

Hexadecimal to integer conversion function

I am working through Kernighan and Ritchie to brush up on my C skills, so I thought I would invite critiques of my code. Here is my Hex-to-int function: ...
5
votes
1answer
100 views

Function that converts file eol's

I've been unable to find a PHP function that will convert eol in files. This is what I have so far. It works, no errors. Your educated opinions, thoughts, improvements, potential bugs and ...
10
votes
3answers
687 views

Is decimal, hexadecimal, octadecimal, binary converter efficient?

I have made a method which takes two parameters: the value to convert and the base. Based upon those two parameters my method is adjusted (with several helper methods) to change the desired decimal ...
2
votes
1answer
82 views

Refactor ConvertorToString class

Help me refactor this class that helps to represent an object state as String: ...
5
votes
1answer
49 views

Conversion from decimal to negabinary and vice versa in Haskell

Recently I set about to writing conversion functions in Haskell between decimal and negabinary. I tried to write them in as much functional a style as possible, also aiming at brevity. Below I present ...
5
votes
1answer
6k views

Converting List to a DataTable and/or DataSet Extension Methods

Can someone help me improve this code? I and trying to have a couple extension methods to convert strongly-typed lists to a DataSet and ...
6
votes
4answers
743 views

Function to convert ISO-8859-1 to UTF-8

I wrote this function last year to convert between the two encodings and just found it. It takes a text buffer and its size, then converts to UTF-8 if there's enough space. What should be changed to ...