tagged [integer]

How to get the Enum Index value in C#

How to get the Enum Index value in C# In C, `enums`, internally equates to an integer. Therefore we can treat data types of `enum` as integer also. How to achieve the same with C#?

2 Jun at 10:44

Declaring an unsigned int in Java

Declaring an unsigned int in Java Is there a way to declare an unsigned int in Java? Or the question may be framed as this as well: What is the Java equivalent of unsigned? `String.hashcode()`

16 Nov at 16:9

Convert string with comma to integer

Convert string with comma to integer Is there any neat method to convert "1,112" to integer 1112, instead of 1? I've got one, but not neat:

8 Mar at 03:19

Can I convert long to int?

Can I convert long to int? I want to convert `long` to `int`. If the value of `long` > `int.MaxValue`, I am happy to let it wrap around. What is the best way?

Extract a single (unsigned) integer from a string

Extract a single (unsigned) integer from a string I want to extract the digits from a string that contains numbers and letters like: I want to extract the number `11`.

22 Nov at 10:33

What is the conversion specifier for printf that formats a long?

What is the conversion specifier for printf that formats a long? The `printf` function takes an argument type, such as `%d` or `%i` for a `signed int`. However, I don't see anything for a `long` value...

4 Nov at 21:1

Difference of using int and uint and when to use

Difference of using int and uint and when to use What is the difference between using int and uint? All the examples I have seen so far are using int for integers. Any advantage of using uint? Thanks.

11 Nov at 17:26

How to split a string of space separated numbers into integers?

How to split a string of space separated numbers into integers? I have a string `"42 0"` (for example) and need to get an array of the two integers. Can I do a `.split` on a space?

2 Jul at 10:4

Parse v. TryParse

Parse v. TryParse What is the difference between Parse() and TryParse()? Is there some form of error-checking like a Try-Catch Block?

19 Dec at 23:8

Is there a way to convert number words to Integers?

Is there a way to convert number words to Integers? I need to convert `one` into `1`, `two` into `2` and so on. Is there a way to do this with a library or a class or anything?

25 Mar at 05:10

How could I convert data from string to long in c#

How could I convert data from string to long in c# How could i convert data from string to long in C#? I have data now i want it in

PHP - Large Integer mod calculation

PHP - Large Integer mod calculation I need to calculate modulus with large number like : It's not working... because $largenum is too big for an int in PHP. Any idea how to do this ?

16 Jun at 09:20

Convert integers to written numbers

Convert integers to written numbers Is there an efficient method of converting an integer into the written numbers, for example: would return "Twenty One". Is there any way of doing this that doesn't ...

31 Jan at 14:33

What is the maximum float in Python?

What is the maximum float in Python? I think the maximum integer in python is available by calling `sys.maxint`. What is the maximum `float` or `long` in Python? --- [Maximum and Minimum values for in...

How to concatenate a std::string and an int

How to concatenate a std::string and an int I thought this would be really simple, but it's presenting some difficulties. If I have How do I combine them to get a single string `"John21"`?

17 May at 14:39

How to convert an IPv4 address into a integer in C#?

How to convert an IPv4 address into a integer in C#? I'm looking for a function that will convert a standard IPv4 address into an Integer. Bonus points available for a function that will do the opposi...

19 Jul at 03:46

C#: How to convert long to ulong

C#: How to convert long to ulong If i try with BitConverter,it requires a byte array and i don't have that.I have a Int32 and i want to convert it to UInt32. In C++ there was no problem with that.

27 Mar at 05:36

Int division: Why is the result of 1/3 == 0?

Int division: Why is the result of 1/3 == 0? I was writing this code: The result is 0. Why is this, and how do I solve this problem?

14 Dec at 18:25

What do numbers using 0x notation mean?

What do numbers using 0x notation mean? What does a `0x` prefix on a number mean? It's from a C program. I can't recall what it amounts to and particularly what the letter `x` means.

16 Jan at 07:50

How can I convert an int to a string in C?

How can I convert an int to a string in C? How do you convert an `int` (integer) to a string? I'm trying to make a function that converts the data of a `struct` into a string to save it in a file.

6 Feb at 16:27

Get int from String, also containing letters, in Java

Get int from String, also containing letters, in Java How can I get the int value from a string such as `423e` - i.e. a string that contains a number but also maybe a letter? `Integer.parseInt()` fail...

26 Feb at 00:49

How to get the separate digits of an int number?

How to get the separate digits of an int number? I have numbers like 1100, 1002, 1022 etc. I would like to have the individual digits, for example for the first number 1100 I want to have 1, 1, 0, 0. ...

2 Aug at 16:0

Integer formatting, padding to a given length

Integer formatting, padding to a given length I need to pad the output of an integer to a given length. For example, with a length of 4 digits, the output of the integer 4 is "0004" instead of "4". Ho...

13 Oct at 04:37

Java integer to byte array

Java integer to byte array I got an integer: `1695609641` when I use method: gives: but I want a byte array: How can I make this?

15 Dec at 23:36

Why I cannot the get percentage by using Int

Why I cannot the get percentage by using Int Please forgive my programming knowledge. I know this is a simple thing, but I do not understand why result is always 0. Why decimal will be fine? Many than...

8 Apr at 18:27