I would like my function to follow some convention to check if my ticket number needs formatting or not.
If the convention is not met, then I would like to make some changes to the ticket number.
Example
Ticket number
19K3072216 needs to be formatted to this
19-K3-07-002216 because it does not meet the following conditions.
For this ticket number, I would like to do the following:
1. Check if the 1st 2 digits has a value 0 - 9 (numeric)
2. Check if the 3rd digit has a value of A or Z
3. Check if the 4th digit has a value 0 - 9 (numeric)
4. Check if the 5th and 6th digits has a date value (e.g.2 digit year - 17, 90, 15 etc)
5. Check if the next 6 digits i.e. 7th - 12th digits are numeric
Because ticket number
19K3072216 does not meet the above conditions, I would like my function to format it to look like this
19-K3-07-002216
So Return strCaseNumber should contain formatted ticket number
19-K3-07-002216
My vb.net function
Public Class Ticket_Code
Public Shared Sub main()
Dim strTicketNumber As String = FixTicketNumber("19K3072216")
End Sub
Public Shared Function FixCaseNumber(ByVal astrCaseNumber As String) As String
Dim strCaseNumber As String = Replace(astrCaseNumber, "-", "")
How do I do this?
Return strCaseNumber
End Function
End Class
What I have tried:
<pre lang="vb">Public Shared Function FixCaseNumber(ByVal astrCaseNumber As String) As String
Dim strCaseNumber As String = Replace(astrCaseNumber, "-", "")
Return strCaseNumber
End Function