Questions tagged [converting]

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

Filter by
Sorted by
Tagged with
7
votes
1answer
79 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... ...
1
vote
1answer
71 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
70 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 ...
1
vote
1answer
63 views

Implementation of itoa

...
1
vote
1answer
63 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
678 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
56 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
29 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
101 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
77 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
30 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
57 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
111 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
148 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
282 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
98 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
126 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
937 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
90 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
226 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
64 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" ...
4
votes
1answer
453 views

Converting a binary string to hexadecimal using Rust

Once again, I am reinventing the wheel here to understand the fundamentals of rust. In a previous question I requested feedback on my function that performed a hexadecimal to binary conversion. In ...
5
votes
1answer
207 views

Converting a hexadecimal string to a binary string using Rust pattern matching lookup

I am getting started in Rust, and as a part of my first exercise, I decided to write a small program that converts a hexadecimal string to a binary string using a pattern matched lookup. I would ...
9
votes
1answer
149 views

Convert to dictionary

Earlier I did post with full code about Prepare and export data to MS Word file. The user t3chb0t recommended me to separate some part of full code to this post. Context The task of code for review ...
3
votes
1answer
96 views

Convert a Binary Tree to Doubly Linked List

Challenge Link on geeksforgeeks: Binary Tree to DLL Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL) In-Place. The left and right pointers in nodes are to be used as previous ...
4
votes
2answers
117 views

Converting a set into a string

The input is a set of alphabets. The output is a string of 32 in length. For any letter in the set if it is preceded by a '¬' we replace the n-th character in our output string with '0', such that n ...
7
votes
3answers
265 views

Convert HTML color to OLE

I have this function that takes a string which represents a html-color and returns the OLE value for it. If the string is null or empty or it can't be parsed, it uses a default value. However I have ...
1
vote
1answer
115 views

Format the output of Color.ToString() to RGB values [closed]

The method that I wrote below functions properly; however, I believe that the code I wrote is not clean nor "good". I know the basics of regex but I do not know more advanced techniques as I am still ...
2
votes
1answer
93 views

Static Methods for Dealing with Conversions from and to UTC

I asked this question over at stackoverflow but was told it may be better suited here. So I absolutely want to store DateTimeOffset objects in UTC format. To ...
3
votes
2answers
51 views

Excel To CSV Converter Ch 9 ATBS

I am learning more about python using the book "Automate The Boring Stuff". The problem I completed was "Excel To CSV Converter". I want to kick bad habits to the curb, and make sure I'm learning the ...
2
votes
2answers
68 views

Dephi: faster way to convert a “dirty” string to a number

How can I make this code faster? the string can contain characters such as ", .?#" and possibly others. ...
6
votes
2answers
206 views

Internal and external datatype converter

One of the big problems I have is cleanly converting from an internal datatype to an external datatype. We can all do it the not so clean way, however I think this add too much mess. I can use ...
4
votes
1answer
47 views

Get local datetime from UTC time

One of the app is inserting date in UTC format (column CreateDate). When reporting from this table, I used a difference in hours between the inbuilt ...
3
votes
1answer
483 views

Convert *.VCF contact file for cellphone import

My new mobile phone is capable of importing contact information from a renamed *.VCF file stored on an SD memory card (https://www.quora.com/How-do-I-sync-contacts-on-Nokia-130). Annoyingly, it does ...
10
votes
5answers
17k views

Convert a custom object to a query string

I wrote an extension method that takes a custom object and converts its properties to a query string for use in a URL. You can specify what properties you want included by using a ...
2
votes
0answers
53 views

String to long double conversion using FBLD

I always wanted to try fbld x87 instruction to aid to convert string to floating point value. I sure a chance to face this instruction in disassembly of all the ...
4
votes
2answers
486 views

Convert data frame to list of lists by row

I am rewriting some old code where I take a dataframe in r and convert it using the tidyverse packages to a list of lists, where ...
2
votes
4answers
179 views

Taking 2 command line inputs and verifying that they are integers, within the correct range of values

I'm taking 2 command line inputs, which have to be integers between 2 and 1,000,000. These two values are then passed into the getPrimes function, which is just a ...
2
votes
0answers
84 views

Converting between bases (2 to 221) with optional seeds and padding

It's been a while since I had a bit of fun getting something useless working, so I thought I might as well ask if there's anything to improve about how I do things. The original idea was to convert <...
3
votes
1answer
5k views

Generate JSON File from a given YAML file

I'm didn't use java for a long time(5 years ± ) and in the following code the user should provide yaml file and it converting it to json file. The code is working as expected but since I didn't use ...
4
votes
1answer
799 views

constexpr Endian conversion in c++14

This is my take for constexpr big / little endian conversions. The code supports only little and big endian; mixed endian such PDP is not supported. ...
8
votes
2answers
3k views

Convert mixed-format phone numbers to pure numbers

I am just getting started with C# and wanted to make sure that I am aware of any errors/inefficiencies in my code. For this specific project, I wanted to prove to someone that a "bot" could easily ...
2
votes
0answers
436 views

Convert FoxPro/dBase DATETIME field to Win32 SYSTEMTIME struct

I'm trying to write a complete driver for Visual FoxPro's DBF format for Win32. I found that the way that fields of the DATETIME type are stored in dBase files is ...
4
votes
3answers
318 views

Converting from decimals to roman numerals

I've submitted the following code for a job interview, and I wanna know if there is anything I can improve on it, or better ways to do the same thing. ...
4
votes
1answer
203 views

Extending COERCE to other reasonable object type conversions

It's a basic principle in AI that different problem representations can either facilitate or impede a solution. Being able to readily switch data representations while programming in Common Lisp may ...
2
votes
0answers
106 views

ByteUnit class to convert across size units

Based on java.util.concurrent.TimeUnit class I wrote similar class to convert size units: ...
1
vote
1answer
2k views

Hex-string representation of a byte array [closed]

I have a legacy method toHex(byte[]) used in my application since the beginning of time to store a hexadecimal representation of a ...
5
votes
5answers
829 views

Enum with a lot of items and a long case statement to convert from string

Recently I wrote this class and it has a enum of all the interaction types a game item can have. What I want to know is, it seems a bit of a stretch to have a huge enum then that long switch, is there ...
0
votes
2answers
17k views

Interpret YYYYMMDD as the nth day of the year [closed]

I am provided a bunch of dates in the format (YYYYMMDD) such as: date='20170503' My goal is to convert that date into the ...

1
2 3 4 5
7