Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
check variable type
#1
1)
How can I check what type a variable is?
example
Macro Macro9
Code:
Copy      Help
ARRAY(int) i

;.
;. code
;.

out "i is 'ARRAY'"



2)
I want to check if file names or folder names end with a number.
I have this code
Macro Macro8
Code:
Copy      Help
str check_string="test_name0"
get_last_char(check_string)
int x=val(check_string)
out x

whith this function
Function get_last_char
Code:
Copy      Help
/

function str&check_string

str char
int q=len(check_string)
char.get(check_string q-1 1)

check_string=char


The problem is that the string "check_string" contains a string that ends with '0' (zero).
The 'val' command returns a zero if number is to big or it is not a number.
If I had a string that was "setup_v1.0" the "out x" would result in 0 in the output window.
But how do I know that zero is based on error or actually based on integer value zero?


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)