teletubby5e
Technical User
Hello all,
I have a script that gets screen output from a 5e switch via a telnet session, reads a string from a line, and then performs some "scrubbing " to get it into a manageable format for us to use. Is there a "STRDELC" sort of command. I am trying to read a string NUM1, and see if there are any nonnumeric characters, then del them. leaving only the numbers.
here is part of a scrpt that I cant remember where I got, called isnum.was
func ISNUM : integer
param string NUM1
integer iLen, iCount, iVal
strlen NUM1 iLen ; PUTS LENGTH OF NUM1 INTO ILEN
for iCount = 0 upto iLen-1 ; LOOPSTO END OF NUM1
strgetc NUM1 iCount iVal
; IF A NONNUMERIC CHARACTER
if ((iVal < 48) || (iVal > 57))
return 0 ; DO THIS
endif
endfor
return 1 ; ELSE DO THAT
endfunc
WHERE IT SAYS RETURN 0, I AM WANTING TO DELETE ONLY THE CHARACTER IF IT IS NOT A NUMBER. AM I GOING TO NEED TO DO AN ITOA CONVERSION YOU THINK?
THANKS, JEFF
I have a script that gets screen output from a 5e switch via a telnet session, reads a string from a line, and then performs some "scrubbing " to get it into a manageable format for us to use. Is there a "STRDELC" sort of command. I am trying to read a string NUM1, and see if there are any nonnumeric characters, then del them. leaving only the numbers.
here is part of a scrpt that I cant remember where I got, called isnum.was
func ISNUM : integer
param string NUM1
integer iLen, iCount, iVal
strlen NUM1 iLen ; PUTS LENGTH OF NUM1 INTO ILEN
for iCount = 0 upto iLen-1 ; LOOPSTO END OF NUM1
strgetc NUM1 iCount iVal
; IF A NONNUMERIC CHARACTER
if ((iVal < 48) || (iVal > 57))
return 0 ; DO THIS
endif
endfor
return 1 ; ELSE DO THAT
endfunc
WHERE IT SAYS RETURN 0, I AM WANTING TO DELETE ONLY THE CHARACTER IF IT IS NOT A NUMBER. AM I GOING TO NEED TO DO AN ITOA CONVERSION YOU THINK?
THANKS, JEFF