samintz
Scott Mintz
- May
- 1,590
- 27
Whilst investing Steve's feature request, I tried to write a simple @CLASS
function that would return the type of the string using Steve's criteria.
I was surprised to find that a string of a floating point number was not
identified as numeric.
So I went to the help file under @ISDIGIT and @ISALNUM. Each one has
three examples listed. In the case of @ISDIGIT:
echo %@isdigit[0]
echo %@isdigit[123.456]
echo %@isdigit[-123]
Only the first example returns 1. The other two return 0. Based on the
description, that makes sense (ex 2 contains a period and ex 3 contains a
dash). However, it might be nice if the examples showed the expected
results and explained why.
I don't know what the intent of these functions are. If it's for parsing
purposes, then I think I'd be more interested in whether the string is
numeric as opposed to all the digits being numbers. Otherwise, if I'm
only looking at single characters and testing what that individual
character is, then I'd only want to look at the first character of a
string.
Mind you, based on the fact that I probably haven't used these functions
before, it's not all that big a deal to me.
-Scott
function that would return the type of the string using Steve's criteria.
I was surprised to find that a string of a floating point number was not
identified as numeric.
So I went to the help file under @ISDIGIT and @ISALNUM. Each one has
three examples listed. In the case of @ISDIGIT:
echo %@isdigit[0]
echo %@isdigit[123.456]
echo %@isdigit[-123]
Only the first example returns 1. The other two return 0. Based on the
description, that makes sense (ex 2 contains a period and ex 3 contains a
dash). However, it might be nice if the examples showed the expected
results and explained why.
I don't know what the intent of these functions are. If it's for parsing
purposes, then I think I'd be more interested in whether the string is
numeric as opposed to all the digits being numbers. Otherwise, if I'm
only looking at single characters and testing what that individual
character is, then I'd only want to look at the first character of a
string.
Mind you, based on the fact that I probably haven't used these functions
before, it's not all that big a deal to me.
-Scott