Tag: casting

61 votes
11 answers
1.1K views
How to convert a factor to integer umeric without loss of information?

When I convert a factor to a numeric or integer, I get the underlying level codes, not the values as numbers.

avatar
Royal
0 1 0 9
asked 07 September, 2021
66 votes
7 answers
1.7K views
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(v

avatar
Majorie
0 1 0 9
asked 07 September, 2021
63 votes
23 answers
432 views
Convert Int to String in Swift

I'm trying to work out how to cast an Int into a String in Swift. I figure out a workaround, using NSNum

avatar
Deedee
0 1 0 9
asked 07 September, 2021
64 votes
11 answers
978 views
Why don't Java's +=, -=, *=, /= compound assignment operators require casting?

Until today, I thought that for example: i += j; Was just a shortcut for: i = i + j; But if we try this:

avatar
Jeff
0 1 0 9
asked 07 September, 2021
67 votes
30 answers
2K views
How do I convert a string to a number in PHP?

I want to convert these types of values, '3', '2.34', '0.234343', etc. to a numb

avatar
Corrin
0 1 0 9
asked 07 September, 2021