Questions tagged [data-conversion]

This tag refers to the process of converting the data type of one piece of information into another type.

1963 questions
48
votes
13 answers

Windows-1252 to UTF-8 encoding

I've copied certain files from a Windows machine to a Linux machine. All the files encoded with Windows-1252 need to be converted to UTF-8. The files which are already in UTF-8 should not be changed. I'm planning to use the recode utility for…
Sam
  • 483
  • 1
  • 4
  • 4
46
votes
10 answers

Byte array to Hex string conversion in javascript

I have a byte array of the form [4,-101,122,-41,-30,23,-28,3,..] which I want to convert in the form 6d69f597b217fa333246c2c8 I'm using below function function toHexString(bytes) { return bytes.map(function(byte) { return (byte &…
Actung
  • 1,438
  • 1
  • 13
  • 18
43
votes
2 answers

Multi currency - what to store and when to convert?

I have read different Q&A on SO regarding multi currency but none of them are clear to me or do not provide enough details with regards to my use case. Scenario: Company Raddo has 3 branch locations, UK, France and USA. Raddo has base currency US…
42
votes
10 answers

How do I print bytes as hexadecimal?

I know in C# you can use String.Format method. But how do you do this in C++? Is there a function that allows me to convert a byte to a Hex?? Just need to convert a 8 byte long data to Hex, how do I do that?
Danny
  • 9,199
  • 16
  • 53
  • 75
41
votes
12 answers

Translate integer to letters and vice versa (e.g. 0 = "A", 26 = "AA", 27 = "AB")

So I have this function: function toAlpha($data){ $alphabet = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); $alpha_flip = array_flip($alphabet); if($data <= 25){ …
pillarOfLight
  • 8,592
  • 15
  • 60
  • 90
38
votes
5 answers

How do I convert a Char to Int?

So I have a String of integers that looks like "82389235", but I wanted to iterate through it to add each number individually to a MutableList. However, when I go about it the way I think it would be handled: var text = "82389235" for (num in text)…
ibroadsword
  • 383
  • 1
  • 3
  • 6
36
votes
9 answers

How can I convert an integer to float with rounding towards zero?

When an integer is converted to floating-point, and the value cannot be directly represented by the destination type, the nearest value is usually selected (required by IEEE-754). I would like to convert an integer to floating-point with rounding…
Paweł Bylica
  • 3,780
  • 1
  • 31
  • 44
34
votes
5 answers

convert C# date time to string and back

I'm converting C# date time to string. Later when I convert it back to DateTime object it appears that they are not equal. const string FMT = "yyyy-MM-dd HH:mm:ss.fff"; DateTime now1 = DateTime.Now; string strDate = now1.ToString(FMT); DateTime now2…
axe
  • 2,331
  • 4
  • 31
  • 53
31
votes
4 answers

how to convert long date value to mm/dd/yyyy format

Possible Duplicate: converting long string to date I need to convert long date value to mm/dd/yyyy format.my long value is strDate1="1346524199000" please help me
andro-girl
  • 7,989
  • 22
  • 71
  • 94
30
votes
4 answers

Convert string (in scientific notation) to float

I'm trying to import a large .csv file containing text and numbers using genfromtxt in numpy. I'm only interested in two columns. I have most of the import sorted out with: def importfile(root): data = root.entry.get() atw =…
Dr. Toboggan
  • 555
  • 1
  • 6
  • 9
28
votes
4 answers

How to convert a float string to an integer in python 3

I'm new to the whole coding thing...so here goes. Just trying to write a simple number guess game, but also do input validation. So that only integers are accepted as input. I've figured out how to weed out alphabetic characters, so I can convert…
25
votes
3 answers

Convert Latitude and Longitude to point in 3D space

I need to convert latitude and longitude values to a point in the 3-dimensional space. I've been trying this for about 2 hours now, but I do not get the correct results. The Equirectangular coordinates come from openflights.org. I've tried several…
Niklas R
  • 16,299
  • 28
  • 108
  • 203
24
votes
5 answers

Converting arraybuffer to string : Maximum call stack size exceeded

This is my code. var xhr = new XMLHttpRequest(); xhr.open('GET',window.location.href, true); xhr.responseType = "arraybuffer"; xhr.onload = function(event) { debugger; console.log(" coverting array buffer to string "); …
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
23
votes
2 answers

Set a value comparer in ASP.NET Core 3.1

I have used "HasConversion" in my DBContext to define a JSonArray (Language/Value) and save it as a Text field for ages and It works like a charm, I added a new project to my solution, nothing changed but then I got a new error on adding migration…
22
votes
4 answers

Convert text date/time to a real date time in excel

My data is extracted from an application and it has a text that looks like a date/time in excel. How do I actually convert "3/24/2016 11:22:07 PM" (in text) to a real date/time conversion? I've tried formatting the cells but it doesn't work.
user3085606
  • 253
  • 1
  • 2
  • 7