none
Help with code RRS feed

  • Question

  • Right please can someone help me or post the code what I need to do this

    I need the code for my program that checks for 2 Uppercase letters 2 Numbers and 3 Uppercase letters without spaces in between so rather like an ordinary Uk Reg plate e.g. YU25JUL and if it spots an error with this it loops back to the variable 'start'

    many thanks :)  

    Saturday, March 28, 2015 9:04 PM

Answers

  • The following little program detects wrong or good. You have to adapt it to your needs. The are some debugging WriteLines in it to see what happens:

    string="YU25JUL"
    For i=1 To Text.GetLength(string)
      char=Text.GetSubText(string,i,1)
      code=Text.GetCharacterCode(char)
      TextWindow.WriteLine(char+":"+code)
      If i=3 Or i=4 Then
        If code>47 And code<58 Then
          good=good+1
        EndIf
      Else
        If code>64 And code<91 Then
          good=good+1
        EndIf
      EndIf
    EndFor
    If i=8 And good=7 Then
      TextWindow.WriteLine("good")
    Else
      TextWindow.WriteLine("WRONG")
      TextWindow.WriteLine(i+":"+good)
    EndIf
    


    Jan [ WhTurner ] The Netherlands

    • Marked as answer by edstar360 Saturday, March 28, 2015 9:36 PM
    Saturday, March 28, 2015 9:23 PM
    Answerer

All replies

  • The following little program detects wrong or good. You have to adapt it to your needs. The are some debugging WriteLines in it to see what happens:

    string="YU25JUL"
    For i=1 To Text.GetLength(string)
      char=Text.GetSubText(string,i,1)
      code=Text.GetCharacterCode(char)
      TextWindow.WriteLine(char+":"+code)
      If i=3 Or i=4 Then
        If code>47 And code<58 Then
          good=good+1
        EndIf
      Else
        If code>64 And code<91 Then
          good=good+1
        EndIf
      EndIf
    EndFor
    If i=8 And good=7 Then
      TextWindow.WriteLine("good")
    Else
      TextWindow.WriteLine("WRONG")
      TextWindow.WriteLine(i+":"+good)
    EndIf
    


    Jan [ WhTurner ] The Netherlands

    • Marked as answer by edstar360 Saturday, March 28, 2015 9:36 PM
    Saturday, March 28, 2015 9:23 PM
    Answerer
  • Thanks :) it works perfectly
    Saturday, March 28, 2015 9:37 PM