랭귀지/ASP
asp 변수에서 숫자만 걸러내는 함수
유키공
2019. 10. 23. 11:14
숫자 ASCII코드는 48번부터 57번 입니다.
Function RefNumeric(inputStr) a = inputStr result = "" For i = 1 To Len(a) checkStr = Mid(a, i, 1) If Asc(checkStr) > 47 And Asc(checkStr) < 58 Then result = result & checkStr End If Next RefNumeric = result End Function inputStr = "테 스 트12345 67890" Response.write RefNumeric(inputStr)
결과 : 1234567890