Converting involves changing data from one data type or format to another.
2
votes
0answers
16 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
121 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
55 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 ...
3
votes
1answer
29 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.
...
11
votes
7answers
383 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
157 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
259 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
59 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
36 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 ...
4
votes
1answer
103 views
5
votes
1answer
108 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
168 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
516 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
76 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
463 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
76 views
Refactor ConvertorToString class
Help me refactor this class that helps to represent an object state as String:
...
5
votes
1answer
48 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
2k 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
495 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 ...
7
votes
3answers
180 views
Simple MPG calculator in Python
I am a self taught coder taking a Programming Fundamentals class to work towards a degree. It's based on Python, which I'm not as familiar with as other languages. I added error handling like I would ...
4
votes
3answers
68 views
4
votes
3answers
98 views
Number to words problem
This is a very long solution I've been working on to a Number to Words problem. I've identified that there's a lot of repeating logic (e.g. 'if writing > 0', 'writing = integer /',).
How would you ...
8
votes
3answers
215 views
Integer-to-string conversion using recursion
Adapt the ideas of printd to write recursive version of itoa; that is, convert integer into a string by calling a recursive ...
13
votes
5answers
2k views
Temperature conversion in C
I have started to learn C and I have tried my hand at temperature conversion. The idea is to convert a temperature from Fahrenheit to Celsius and vice/versa. Can somebody review my code and let me ...
7
votes
2answers
243 views
Digit to words converter
This is one of the longest programs I have made with methods and I think I must be doing this rather inefficiently. Any comments to improve would be appreciated.
...
3
votes
1answer
185 views
Is this base 62 encoding algorithm okay?
This Scala code snippet is supposed to encode a SHA1 hash in base 62.
Can you find any issues? I'm asking since I might not be able to change the algorithm and, for example, fix issues in the future.
...
10
votes
4answers
286 views
Type system for different representations of angle value
I want to implement a Type system for different representations of an angle value. Motivation to implement this as a type system comes from this question.
Angle can be represented using the ...
1
vote
1answer
90 views
Python converter: number-to-English
So I wrote this function to convert a given number to its interpretation in the English language as part of the Project Euler exercises. It works fine, but I sense that it's rather sloppy and ...
3
votes
1answer
410 views
Convert between date/time and time-stamp without using std library routines
I am trying to implement in C two simple convertors, date/time to time-stamp and vice-versa, without any dependencies on time library routines (such as localtime, mktime, etc, mainly due to the fact ...
14
votes
2answers
332 views
Simple temperature converter
Below is my first attempt at programming a Celsius to Fahrenheit converter in C# winforms. I'm looking for tips and advice on improving my style and what I can do to make the code more ...
2
votes
3answers
675 views
Convert Sql LIKE to Regex
I have a bit of code that converts a Sql Like expression to a regex expression for the purposes of a Linq to objects Like extension method. For some time I have ...
2
votes
3answers
211 views
-1
votes
2answers
2k views
5
votes
1answer
191 views
Roman numerals to decimal
This is an assignment for class. I would like to know how to improve my code. It is a program to convert Roman numerals to it's decimal equivalent. This is what I have so far. There must be a better ...
5
votes
4answers
323 views
Converting std::string to int without Boost
I'm trying to convert an std::string to an int with a default value if the conversion fails. C's ...
3
votes
2answers
181 views
Roman numeral converter in Ruby
For a Project Euler problem, I made a Ruby roman numeral converter:
...
0
votes
1answer
91 views
Null-delimited to printf %b converter
I wrote a D implementation of the nul2pfb utility from here, as the link to the source code was broken and I wanted to try to learn D. I noticed that it was rather slow (could barely keep up with the ...
0
votes
3answers
92 views
Need help optimizing/making this code more efficient
So I'm working on a code where it converts shoe sizes and distance
...
5
votes
3answers
244 views
Organization of measurements converter
I am pretty new to Python but I'm learning from classes.
I am working on a project for class and this is my code. Anyone got a better idea of a way to organize the code or put it differently so there ...
2
votes
1answer
423 views
Converting looped row in table from datetime to string [closed]
I am trying to pull out the whole column for row[3] in the following script. Everything works, but unfortunately, the code is only pulling out the last row's data from the whole page while everything ...
2
votes
1answer
10k views
Faster way to convert DataTable to List of Class
I am using ExcelDataReader to import an excel file to a dataset. Example Excel table below:
...
5
votes
1answer
100 views
YouTube-to-Spotify converter
I have been doing some JS lately and I would like to get some constructive criticism.
The project I am working on
Live demo
...
2
votes
2answers
1k views
Conversion of expression from Prefix to Postfix notation (Problem with precedence) [closed]
I have been attempting to write a code that converts Prefix expressions to Postfix expressions.
So far here's what I have made (note that I am new and hence it may not be efficient!)
...
4
votes
1answer
139 views
Currency converter
I'm just looking for someone to give a critique of my currency converter. I want to see if I could clean it up first before dummy-proofing. I know you want to avoid floating types for working with ...
5
votes
1answer
365 views
Writing the Word Equivalent of a Check (Cheque) Amount
I am looking for feedback on a solution to the following problem posed from a book that I'm working through (Java: How To Program 9th Edition) :-
Continuing the discussion in Exercise 16.20, we ...
0
votes
3answers
477 views
Converting a c# enum into a list to be sent to the client
I want to use the enum on the client for a dropdown list. Does this make sense, or is there a smarter way of doing this?
...
4
votes
1answer
846 views
Floating-point binary/decimal/octal/hex converter
I've finally decided to design a class for this program, but some of the code still looks messy. I'm also a bit concerned about DRY, particularly in ...
2
votes
4answers
218 views
Cleaner and/or more practical code for decimal/binary/hex converter
I've finally finished my converter and have determined that it works, but I'm trying to make it cleaner and/or more practical (primarily with the switch ...
6
votes
2answers
530 views
Converting Roman numerals to decimal
Could someone please point out the error(s) in the given code? It was downvoted on Stack Overflow without any explanation, but it seems to be working fine for me:
...
5
votes
1answer
106 views
Char* hex string to BYTE Array
The idea is that i want any size string to put the corresponding hex value into a byte array. I've seen a million ways to do it. Some of them didn't look to clean. My needs are speed over memory, so ...