Parsing strings

Results 1 to 2 of 2

Thread: Parsing strings

  1. #1
    Warren G Guest

    Default Parsing strings

    hi,<BR><BR> I need the user to enter a hex digit string into a text box and i would like to verify that each char is a hex number (0..9,A..F) by parsing the string - how do I achieve this.<BR><BR>Cheers,<BR><BR>Warren

  2. #2
    Hayden Rogers Guest

    Default RE: Parsing strings

    Here&#039s a fairly basic way to do it:<BR><BR>&#060;%<BR>strText = Request.Form("input") &#039Your own variable name here...<BR>Dim boolOk<BR>boolOk = True &#039this variable states whether the string is ok...<BR>For i = 1 to Len(strText)<BR>strChar = UCase(Mid(strText,i,1)) &#039get the capital letter...<BR>If Not (IsNumeric(strChar) OR strText="A" OR strText="B" OR strText="C" OR strText="D" OR strText="E" OR strText="F") Then<BR>boolOk = False<BR>end if<BR>next<BR>If boolOk Then <BR>&#039 go to page that says it&#039s ok<BR>Response.Redirect "ok.asp"<BR>Else<BR>Response.Redirect "nicetrybutno.asp"<BR>&#039 Re-enter the string<BR>end if<BR><BR>%&#062;<BR><BR>It&#039s quite clumsy, and I wouldn&#039t like to try it with anything too big, but it should be fairly robust...<BR><BR>HR<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts