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

learn more… | top users | synonyms

4
votes
4answers
209 views

Converting the DateTime to and from Unix epoch times

I'm currently working on a thing I needed this feature for. Essentially, these are two methods to convert DateTime objects to and from the Unix epoch time (two ...
3
votes
2answers
66 views

Decorator to convert a function's result into the desired units

I tried to collect some of my formulas inside classes so that I didn't need to browser the names of the functions anymore but only determine which Quantity I want to calculate and then check which ...
3
votes
2answers
84 views

Unit converter application

I am working on an Android unit converter application, but I came to the point where I have to assign the formulas to the calculation method. At the moment I am ...
2
votes
2answers
125 views

Converting from Celsius to Fahrenheit and vice versa

My code asks the user for the type of conversion, the degrees and spits the result back. It will prompt the user to ask for the type of conversion again if it's invalid. It will also prompt the user ...
1
vote
1answer
56 views

Grabs 10 bytes and converts it into a hex formatted string

I'm working on some code right now where the goal is to take in a byte stream and grab the data from the body of a message. The data is 10 bytes long and is meant to be translated into hex. ...
3
votes
2answers
70 views

Python script converts after effects clipboard keyframe data to nuke keyframe data

This is my first 'proper' script since learning python and I'd love it if I could get some feedback on things I've done wrong / things I can improve on. The script takes clipboard data from after ...
1
vote
2answers
105 views

Character-to-string converter

I created a program that will convert a 3-character combo into a 3-string combo. I used a lot of if statements to accomplish the conversion. I'm wondering if there ...
10
votes
4answers
1k views

Arabic to Greek numeral converter, 1 - 10

One of the things that's straight-forward in JavaScript is Unicode support. If you want to return ϝ (lowercase digamma, not a simple ...
7
votes
5answers
2k views

Comparing Old vs. New: Temperature Converter

I made this temperature converter when I first started getting into Python. After a year of regular programming on my own I decide it was time to revisit my old program. Now that I finished my first ...
5
votes
1answer
67 views

Creating PDF files from a ODT template

The code is actually a TemplateBuilder. We have 2 different templates, French and Dutch. We need to change the template and then convert it to PDF so it can be stored in the DB later. The main method ...
-5
votes
1answer
74 views

Python to Ruby: inconsistency with float ceil() [closed]

Just for fun, I am trying to convert the following Python from math import * print map(lambda count: ceil( 6 * cos((count + i) * pi / 5) ), range(100)) Which ...
4
votes
2answers
121 views

Converting hex to integer

What's the fastest way of doing this? ...
5
votes
1answer
109 views

Function to convert a decimal number as a string to hexadecimal

I am designing a cipher and need to convert between bases repeatedly in a loop. I have optimized the everything else, but I'm not too familiar with C++ code, and and am trying to figure out how to ...
2
votes
1answer
33 views

Handler for bidirectional unit conversion form

Building a form where values can be entered in either pounds or kilos. Script is... ...
11
votes
6answers
793 views

Converting strings to PascalCase

I have a method which I use on occasion to convert strings (like enum and property names) to PascalCase for display. It's ...
16
votes
3answers
873 views

SI unit converter

I recently started "coding" and this is one of my first "projects". It is supposed to be an SI converter where you can type a value, its unit and the unit to which you want it to be converted. ...
2
votes
2answers
139 views

Parsing from one enum to another

I face a problem I think I am not approaching appropiately. I have two independent enumerators that both will contain the same members, the only difference being the values given. I have to be able ...
4
votes
2answers
337 views

Java conversion of base 16 to base 64

I wrote a solution in Java to solve the problem here. I use BigInteger to convert first from base 16 to base 10, then base 10 to base 64. This seems quite ...
4
votes
3answers
579 views

12 hours to 24 hours conversion function

I have made a time format converter which converts 12 hour format to 24 hour format. My convert_to_24() takes a string in format of ...
7
votes
1answer
101 views

Three-way conversion between Japanese writing systems

When my go-to Japanese transcription site went down for a while, I decided to write my own. My application converts between Romaji, Hiragana and Katakana — however, unlike any other converter ...
0
votes
2answers
815 views

Currency converter in Python [closed]

I am looking for some ways to make my code simpler for this currency converter. ...
3
votes
2answers
497 views

Converting a 12 hour time string to a 24 hour time string

Input - Standard input - HH:MM:SS[AM|PM] format. Examples: 12:00:00AM 12:00:00PM 01:00:10AM 01:00:10PM The program reads one line per instance. Output - military format (24 hour format): ...
10
votes
3answers
379 views

Binary Converting Code

I made a program that converts a decimal number given from the user, and converts it to a binary number. For example, if I entered 2, it would return 10. It then, counts the amount of ones and zeros ...
3
votes
2answers
50 views

Convert hex encoded string to byte array

The following should read a hex string such as "ece998a2fb" into vector 236 233 152 162 251. I was unable to find any built in ...
5
votes
1answer
320 views

Converting IP Addresses to minimal binary formats

Once more, I come to you for assistance! I have written a significant bit of code that converts IP Addresses from strings to minimal byte-arrays. (So that you can store them in a binary format instead ...
1
vote
1answer
152 views

Convert string to integer or default

I need my string-to-int converter to handle all exceptions without throwing any errors. I also have a use case where I need the default value to be less than zero if the ...
1
vote
1answer
59 views

Celsius and Fahrenheit Converter

I'm very new to programming in C and I attempted to make a program that converts temperatures to and from Fahrenheit and Celsius. I have been running the program and I have realized that not all ...
1
vote
1answer
62 views

Filter to convert duration to hours — in controller or model?

I have this before_action method : ...
3
votes
2answers
355 views

Java Temperature Converter GUI

Today is my first time working with GUI, so I'm really interested in the best ways of handling various events to get the best habits from the jump. Most of the GUI-related code for this project was ...
4
votes
2answers
144 views

Basic distance conversion program

This is a simple program to convert miles, yards, feet, and inches appropriately. Everything intended for works but I feel my program is very redundant. How can I make it more efficient and less lines ...
5
votes
1answer
193 views

Hex to Double converter

I stumbled on this SO question which was asking about a way to convert larger hex values to a positive numeric value: ...
12
votes
1answer
2k views

Roman Numerals in Java

I wrote a class that can convert to and fro from Roman Numerals and Decimals. I would appreciate critical points on everything, especially: Shortening my code. Choosing a better approach. Using ...
1
vote
2answers
55 views

Decimal to Roman numeral conversion algorithm

I have written a program to convert a decimal to a Roman numeral. I am wondering if my algorithm is okay or not. If it's not okay, I want suggestions on improving my code. This code only works in ...
7
votes
5answers
856 views

Creating a numeric phone keypad

I'm writing a Telephone class and it has a method called getDigits which takes in a String parameter and returns the number that would appear on your phone if you ...
7
votes
1answer
340 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 ...
6
votes
4answers
357 views

Character to decimal conversion

This converts from character representation of integers to their decimal value: ...
6
votes
5answers
392 views

Using functions to separate code for Fahrenheit to celsius conversion

I'm relatively new to programming, and I've been wondering about a problem such as this. How can I think about decomposing the code into its constituent functions? I went the simplest route I could, ...
6
votes
2answers
125 views

Number converter between bases

I just wrote a utility program in C that converts numbers of different bases to 'standard' well-known bases (hex, dec, oct, bin). I called it repnum, short for ...
9
votes
3answers
176 views

HTML to Markdown converter

I've made a simple HTML→Markdown converter in Javascript and am looking for any feedback. For now, I've basically used Stack Exchange's /editing-help as a guide as ...
4
votes
1answer
207 views

GUID to hex-string and back

I'm new to Python and I'm trying to convert between Microsoft GUIDs and plain hex strings: ...
3
votes
3answers
1k views

Unit Converter in Python

I am new to programming and I am trying to make a simple unit converter in python. I want to convert units within the metric system and metric to imperial and vice-versa. I have started with this code ...
3
votes
1answer
49 views

Map strings to (const) ints

I'm imagining go generate would be a good tool for this. I want to convert strings to ints to save space. ...
1
vote
1answer
814 views

Powershell to Convert HTML Table to Array of PSCustomObject

I created the below script to sent a request to a website, then convert the table in the results to an array of PSObjects which I can work with in PowerShell. This uses some nasty hacks (e.g. using a ...
3
votes
2answers
571 views

Currency converter using MVC pattern in C++ & QT

While understanding the MVC pattern, I came across this particular article. I thought to implement it using the C++/QT library. The intent over here is to implement/use MVC concepts in correct way. ...
3
votes
2answers
537 views

Converting numbers to English words

This is a simple program to convert a number, from 0 up to 99999999, to English words. Example: If the input is: 1234 The output would be: one thousand ...
10
votes
2answers
1k views

Convert Persian digits to English numbers

I use the following code to convert ۱۲۳۴۵ to ‍12345, effectively transliterating the persian numbers into latin numbers: ...
3
votes
2answers
140 views

Integer to English Conversion

I wrote some code to translate numbers ( for now just positive, up to the 32bit limit ) into English words. Everything works and I'm happy. I searched through the site looking for a comparison code ...
6
votes
4answers
231 views

Converting from decimal to word

I'm still investigating the problem with decimal to word conversion. I understood the basics, but now my goal is to learn how to add in base-26 (the English alphabet) or base-52 (...
0
votes
3answers
72 views

Low-latency implementation of converting non null terminated char* to unsigned int

How would you rewrite this code which I have now: ...
12
votes
2answers
544 views

Returning result and error status for number type conversions

Looking for review of design strategy of using a struct to return the functional result and error status. Your experience of how my design approach may succeeded ...