IsInt, IsDouble, and IsNumeric
HegemonKhan
22 Dec 2013, 10:52A quick question...
Is there any differences between them:
IsInt and IsNumeric
~and~
IsDouble and IsNumeric
???
if there are, could you explain those differences for me?
Is there any differences between them:
IsInt and IsNumeric
~and~
IsDouble and IsNumeric
???
if there are, could you explain those differences for me?
Liam315
22 Dec 2013, 11:48As far as I can make out, IsDouble and IsNumeric seem to be exactly the same, although a slight difference may exist I'm not aware of.
IsInt only returns true if the string input converts to a whole number. So IsInt("1") would return true but IsInt("1.1") would return false. IsDouble recognises the decimal place, as does IsNumeric. i.e. Both IsNumeric("1") and IsDouble("1.1") would return true.
IsInt only returns true if the string input converts to a whole number. So IsInt("1") would return true but IsInt("1.1") would return false. IsDouble recognises the decimal place, as does IsNumeric. i.e. Both IsNumeric("1") and IsDouble("1.1") would return true.
Entropic Pen
22 Dec 2013, 12:55Speaking out from my knowledge of visual basic, IsNumeric is a Boolean test to check if the string in question is a number, integer or double. But if I'm wrong you're welcome to correct me and the C+ I got in .Net Programming. Get it? C+... Visual Basic? I'M FUNNY TOO YOU KNOW!
And just in case some one doesn't know:
Integers are numbers without the decimals: 1, 2, 10, 15
Doubles are numbers with decimals: 1.1, 2.4, 10.5, 15.000001
And just in case some one doesn't know:
Integers are numbers without the decimals: 1, 2, 10, 15
Doubles are numbers with decimals: 1.1, 2.4, 10.5, 15.000001

jaynabonne
22 Dec 2013, 19:09Not to add to the soup too much, but there does seem to be overlap. Looking at how these are implemented, there is definitely redundancy.
IsInt: implemented using C#'s "int.TryParse". It will return true if the string can be evaluated as an integral number. So "1", "45" and "7771013" would return true, but "3.1415", "My name is Legion" and "45 kisses" would not.
IsDouble: implemented using C#'s "double.TryParse". It will return true is the string can be evaluated as a floating point number of some kind. So "1", "3.1415" and "0" would return true, but "123 Skidoo" and "Merry Christmas!" would not.
IsNumeric: implemented using VB's IsNumeric. It returns true if the string can be converted to a number, so it seems it will return the same as IsDouble.
I haven't explored whether these will work with scientific notation (e.g. 6.02e+23).
Hope that helps somewhat.
IsInt: implemented using C#'s "int.TryParse". It will return true if the string can be evaluated as an integral number. So "1", "45" and "7771013" would return true, but "3.1415", "My name is Legion" and "45 kisses" would not.
IsDouble: implemented using C#'s "double.TryParse". It will return true is the string can be evaluated as a floating point number of some kind. So "1", "3.1415" and "0" would return true, but "123 Skidoo" and "Merry Christmas!" would not.
IsNumeric: implemented using VB's IsNumeric. It returns true if the string can be converted to a number, so it seems it will return the same as IsDouble.
I haven't explored whether these will work with scientific notation (e.g. 6.02e+23).
Hope that helps somewhat.
HegemonKhan
22 Dec 2013, 22:14thanks for clarifying and explaining them, I was mainly just wondering if there was something else or more to what the "IsNumeric" does, as from the wiki it sounded the same to the "IsInt~IsDouble".
Also, thanks for touching up on my other question that I forgot to ask about:
what about strings with both letters (ABC...Z) and numbers (-1,0,1) ???
as from your posts, the string must be entirely numeric (for true) for the IsInt, IsDouble, and IsNumeric, so is there a way to deal when you got both characters (ABCs+123: potion_123), or would we have to craft our own function presumably using the "character" scripts (StartsWith, EndsWith, LengthOf, and etc). Or, is the only way for something to be recognized as numeric, is for it to be 100% numeric (for being recognized as an Int or Double), as otherwise, it's a (Type) String? Can you "parse" (I need to learn what exactly parsing is~means at some point, lol) within a string, as what parts of it are numerical and what parts are alphabetic (ABCs) ???
(Sora's Stackable Library may address this very question, but I haven't looked at it in a while, and it's also a bit too advanced for me at this point to try to understand and learn, lol)
This is just for curiousity, as I'm not sure why this would be used, no examples of why it would be needed or wanted, I'm just trying to understand and learn more about coding.
-------------
@Entropic,
I "C" now, wink, thank you for your help.
Is getting "C+" in programming class, mean that you understand the language well or only mediocre'ly ??? hehe
Also, thanks for touching up on my other question that I forgot to ask about:
what about strings with both letters (ABC...Z) and numbers (-1,0,1) ???
as from your posts, the string must be entirely numeric (for true) for the IsInt, IsDouble, and IsNumeric, so is there a way to deal when you got both characters (ABCs+123: potion_123), or would we have to craft our own function presumably using the "character" scripts (StartsWith, EndsWith, LengthOf, and etc). Or, is the only way for something to be recognized as numeric, is for it to be 100% numeric (for being recognized as an Int or Double), as otherwise, it's a (Type) String? Can you "parse" (I need to learn what exactly parsing is~means at some point, lol) within a string, as what parts of it are numerical and what parts are alphabetic (ABCs) ???
(Sora's Stackable Library may address this very question, but I haven't looked at it in a while, and it's also a bit too advanced for me at this point to try to understand and learn, lol)
This is just for curiousity, as I'm not sure why this would be used, no examples of why it would be needed or wanted, I'm just trying to understand and learn more about coding.
-------------
@Entropic,
I "C" now, wink, thank you for your help.
Is getting "C+" in programming class, mean that you understand the language well or only mediocre'ly ??? hehe

Liam315
23 Dec 2013, 00:02HegemonKhan wrote:Also, thanks for touching up on my other question that I forgot to ask about:
what about strings with both letters (ABC...Z) and numbers (-1,0,1) ???
as from your posts, the string must be entirely numeric (for true) for the IsInt, IsDouble, and IsNumeric, so is there a way to deal when you got both characters (ABCs+123: potion_123), or would we have to craft our own function presumably using the "character" scripts (StartsWith, EndsWith, LengthOf, and etc). Or, is the only way for something to be recognized as numeric, is for it to be 100% numeric (for being recognized as an Int or Double), as otherwise, it's a (Type) String? Can you "parse" (I need to learn what exactly parsing is~means at some point, lol) within a string, as what parts of it are numerical and what parts are alphabetic (ABCs) ???
- You would have to code your own function that was looking for a specific result. To create a function that returns a boolean value if the string has numbers and letters would be largely pointless as that would likely account for 99.9% of all strings in your code.
- You could create a code that returns true if a number is in any part of the string, this would be quite a simple matter using the Instr function. As would extracting the number(s) from the text.
- Parsing means to look at something and evaluate it according to certain rules. Usually in these quest contexts, an input or string value.