Questions tagged [converting]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
69 views

Python IPv6 verifier, parser and converter

This is a simple Python 3 program that verifies whether a string is a valid IPv6 address or not, parses IPv6 address to its hexadecimal and decimal values, and converts an integer to IPv6 format. I am ...
3
votes
4answers
252 views

Convert number 1-5 from its spelt-out form

I'm working with an API that for some strange reason returns star ratings as words, like FIVE,FOUR,THREE,TWO,ONE. As far as I can see, there's no way to just get ...
3
votes
3answers
93 views

Convert program arguments to std::wstring

Due to recent need I wrote a simple main function that has the goal to convert the C-style strings and arrays into a more STL-style. Then because I also had a need ...
2
votes
3answers
111 views

Convert string to integer and catch errors

I have attempted [and made one] function to convert string to integer and catch errors in pure c Working method The whole working method is present in code itself The header file The str2num.h here:- <...
3
votes
1answer
106 views

Python 3 script to phonetically transliterate written English to Cyrillic and/or Greek

This is a Python 3 script I have written over three days that transliterates (not translating) English orthography written in Latin alphabet to the Cyrillic alphabet, the Greek alphabet or a mixed of ...
0
votes
2answers
72 views

Python 3 integer seconds to date-time string convertor

I have written two functions that output a date-time string for any given non-negative integer. The integer is treated as representing total number of seconds in a given time period, the first ...
1
vote
1answer
67 views

Python 3 arbitrary base converter and base36 encoder

This is a script that can convert any numerical value to any arbitrary radix representation and back, well, technically it can convert a number to any base, but because the output is a string ...
2
votes
1answer
57 views

Is it good way to user dao when assembling dto to entity or not?

I have User entity that has relationship to other entities(Order,Profile) When I assemble entity from dto and back I need assemble order and profile entity too. User entity: ...
6
votes
1answer
96 views

Assembler. Algorithm for incrementing a decimal number

I share an algorithm that I have written myself. It is useful for incrementing any digit of a decimal number. That way, a conversion to decimal is not necessary. Please excuse the mistakes. I am ...
2
votes
3answers
240 views

Python binary, decimal, hexadecimal, IPv4, octal converter

This is a Python (3) script that converts numbers among 5 data formats: binary, decimal, hexadecimal and octal, it supports 16 conversions, that is, it can convert each of the five data formats to and ...
3
votes
1answer
191 views

PowerShell script binary-decimal-hexadecimal-ipv4 convertor

This is a fully functional PowerShell script I wrote not long ago that converts data (numerical data) among 4 data formats: binary, decimal, hexadecimal and ipv4. It supports 12 conversions, it can ...
6
votes
4answers
938 views

Bytes to binary conversion function

I created a quick function to convert n bytes into binary for my student. She is not on that level yet, but I think it would be best for her if my demonstrative ...
6
votes
2answers
259 views

Flatten JSON to string

The code below is a Python module to flatten JSON-like structure (nested dictionaries and lists) to a single string. It also provides partial result in the form of flat list of strings. This ...
1
vote
1answer
43 views

convert .sav SPSS files into long or flat format CSVs

I'm a long standing PHP, JS, C#(Unity) dev looking to get outside objects and lower down. I've written a quick program to read binary data from a .sav file, and output the data section into CSV's in ...
1
vote
1answer
83 views

Binary-Decimal-Hexadecimal converter

I'm a fairly new programmer and have been learning c++ for about 8 months now. I've written a program that can take either binary, hexadecimal, and decimal inputs and convert them to the other two ...
2
votes
3answers
254 views

ArrayDowncasters Implementation for Downcasting from System.Array to Array of Specific Type in C#

I am working with System.Array and I am trying to convert System.Array objects to array of specific type (such as ...
3
votes
2answers
635 views

PowerShell script to convert .reg files to PowerShell commands

This is a PowerShell script I wrote a while ago that converts Windows Registry files to PowerShell commands(New-Item, Remove-Item...
1
vote
1answer
125 views

ConvertAll Methods Implementation for Jagged Arrays in C#

This is a follow-up question for ConvertAll Methods Implementation for Multidimensional Array in C# and ConvertAll Methods Implementation for Multidimensional Array in C# - follow-up. Besides the ...
1
vote
1answer
74 views

ConvertAll Methods Implementation for Multidimensional Array in C# - follow-up

This is a follow-up question for ConvertAll Methods Implementation for Multidimensional Array in C#. Thanks to aepot's answer and Olivier's answer. In order to match the usage of the build-in API <...
9
votes
2answers
225 views

ConvertAll Methods Implementation for Multidimensional Array in C#

I am trying to perform some conversions with multidimensional array in C# and I have checked the discussion ConvertAll and 2-dimensional arrays. I found that ...
0
votes
2answers
71 views

Format simple array in multidimensional

I have a simple array in PHP like this : ...
5
votes
2answers
2k views

Represent integer as binary in C

To practice my C, I've written a small function in C to display an integer as an 8-bit binary number. Please let me know how to improve this function, and other C-style coding conventions. Thanks! <...
3
votes
1answer
63 views

Integer to Roman Numeral conversion

As a little standard exercise, I wrote an integer to roman numerals converter in F03. The result looks already neat enough, for my standards, but I wonder whether it could be made snappier without ...
2
votes
1answer
28 views

Input any time, output timezones that are currently that time

I made a program that will take in a time and a weekday, and return which parts of the world are at times closest to the one specified. Part of the program focuses on extracting a date and country out ...
6
votes
1answer
337 views

C++ File Converter Program

Looking for input on how to clean up my code. I am writing a file converter that can read different but related file types (relatable like a wav and mp3 encode audio or how a jpg and tiff encode image ...
1
vote
0answers
62 views

PowerShell - Convert English words describing numbers to their values in Arabic numeral

I am extremely new to programming, and I am a really fast learner if I am interested, I have only started using PowerShell in less than a month, to improve my programming skill, this is a script I ...
8
votes
2answers
650 views

Binary to decimal (and back) converter in c++

I'm mainly looking for error checking / type safety advice. main.cpp ...
3
votes
2answers
90 views

Binary to decimal

Can I make this code somehow faster and is this readable? I'm a beginner and in later I'll make another class with Decimal to Binary conversion, but first I've to know how to do that. ...
7
votes
1answer
2k views

JavaScript string to Unicode (Hex)

This set of questions are related to a project I've published for converting characters, or strings, to Hex based Unicode; eg... ...
2
votes
1answer
121 views

JavaScript -- Convert decimal to another base

The Source code is maintained on GitHub and may be cloned via the following commands. A Live demo is hosted online, thanks to GitHub Pages. ...
3
votes
0answers
366 views

Large Number Scales Names Generator

This JavaScript code generates the full name of the numeral scales for large numbers under the "Short Scale Numeral System" using the Conway-Guy system for forming number prefixes. Some very ...
3
votes
1answer
92 views

Implementation of itoa

...
2
votes
2answers
129 views

Convert C to Swift

I trying to convert this C code for calculating distance from RSSI to Swift code. I try to do it by myself, but considering I'm beginner, I need help in how to do it. Here is C code: ...
6
votes
3answers
2k views

Conversion into hexadecimal using C++

I want to read a vector of eight bytes, convert them into hexadecimal, store them in a std::string and finally write them into a binary file. I am looking for ...
1
vote
0answers
69 views

Convert a TrueType font to a Game Boy tileset

I recently had a need to convert a TrueType font to a Game Boy tileset, so I wrote a program to do it. This correctly aligns the characters on an 8x8 plane and outputs in the form of RGBDS-style ...
2
votes
0answers
30 views

Decoding request object before use it in an Insert query

I want to decode a request object before use it in an insert query. Request object containes the following JSON body: ...
5
votes
2answers
105 views

Code to support different measurement systems

I am developing an application in which the user can use different measurement systems. Currently, there is support for the metric and imperial measurement systems. To support these systems, I wrote ...
1
vote
0answers
158 views

Convert dict to array in Python [closed]

I have a dictionary that looks like this: Counter({(1, 9): 3, (4, 2): 2, (3, 0): 1, (5, 4): 1}) I would like to convert it to an array that would look like this: ...
11
votes
6answers
3k views

Program that converts a number to a letter of the alphabet - follow-up

This is a follow up from my previous post: Program that converts a number to a letter of the alphabet This is meant to teach my little brother (who only knows how to make games in Geometry Dash) ...
3
votes
0answers
92 views

Instant to-and-from Roman Numeral Conversion

Ⅰ Roman numerals are composed of digits taken from a small set of uppercase characters. Lowercase characters were first used in the Middle Ages. $$I,V,X,L,C,D,M$$ With these digits we can represent ...
1
vote
1answer
58 views

Image type convertion

So I have a piece a code that, altough it does what is expected, it doesn't seam very performant to me. I just wanted to know if there's a better way to do this or if my code is alright as it is. The ...
4
votes
1answer
181 views

fasm convert hex byte to binary string

This fasm x64 (Linux) code seems very crude and repetitive, but it gets the job done. How could I perform this task in a more idiomatic manner? ...
5
votes
1answer
188 views

process numerical input arguments of mixed ints, floats, and "array-like" things of same length>1

I'm trying to process numerical input arguments for a function. Users can mix ints, floats, and "array-like" things of ints and float, as long as they are all length=1 or the same length>1. Now I ...
5
votes
1answer
603 views

Normalizing mixed format nested dictionary with delimiter separated keys

I recently worked with some pickle files which had a really strange format where the keys are sometimes delimiter separated with colons and placed in the same depth but also mixed with ordinary key ...
2
votes
1answer
157 views

Convert char array to number

C++17 have <charconv>. However this header does not work on MacOS - It compiles, but can not link. Same header is not present in ...
-1
votes
1answer
181 views

Naming convention when converting between types? [closed]

If I have a method where the input is a list of integers, and within that method I convert the list to a list of strings, what is the best way to name the new list? For example (using ...
5
votes
2answers
1k views

Sum of all digits in a string

Given a string, return the sum of all the numbers in the string, 0 if none are present. Below is my solution for the problem above. I feel like this can be turned into one line. I would really only ...
6
votes
1answer
145 views

Convert a Hex value string to an ASCII Text String

We had a little bit of fun in the 2nd Monitor this morning, one user greeted another with a hex string. It turned out that the user being greeted deals with Hex Dumps enough that they were able to ...
7
votes
4answers
271 views

Code that reads/writes to bytes of an ascii-encoded hex string

Problem Statement Given a hexadecimal string (hascii) and its binary specification (a list of byte field names, their offsets, and byte lengths), design classes to parse all byte-fields, cast bytes ...
3
votes
1answer
69 views

Constructing constrained/validated objects

I'm trying to do some rudimentary DDD in validating my objects to ensure they are of a particular type. I.e. an Email object would always look like "my@example.com" ...

1
2 3 4 5
8