Top "Casting" questions

Casting is a process where an object type is explicitly converted into another type if the conversion is allowed.

Haskell: Converting Int to String

I know you can convert a String to an number with read: Prelude> read "3" :: Int 3 Prelude> read "3" :: Double 3.0 …

string haskell int casting
How should I cast in VB.NET?

Are all of these equal? Under what circumstances should I choose each over the others? var.ToString() CStr(var) CType(…

.net vb.net casting
Swift double to string

Before I updated xCode 6, I had no problems casting a double to a string but now it gives me an …

swift string casting double
What are the rules for casting pointers in C?

K&R doesn't go over it, but they use it. I tried seeing how it'd work by writing an …

c pointers casting
Converting a double to an int in Javascript without rounding

In C# the following code returns 2: double d = 2.9; int i = (int)d; Debug.WriteLine(i); In Javascript, however, the only …

javascript casting floating-point int
error: cast from 'void*' to 'int' loses precision

I have a function with prototype void* myFcn(void* arg) which is used as the starting point for a pthread. …

c++ casting void-pointers
Subtracting 1 day from a timestamp date

I am using Datagrip for Postgresql. I have a table with a date field in timestamp format (ex: 2016-11-01 00:00:00). …

sql postgresql casting
Cast a Double Variable to Decimal

How does one cast a double to decimal which is used when doing currency development. Where does the M go? …

c# casting decimal currency
Cast object to T

I'm parsing an XML file with the XmlReader class in .NET and I thought it would be smart to write …

c# generics casting
Primitive type 'short' - casting in Java

I have a question about the primitive type short in Java. I am using JDK 1.6. If I have the following: …

java casting primitive short