Information générale
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Network:
Windows 2003 Server
Thank you for your ideas. I will research them. I step through the array and check each char in the item to see if it is 2 or 4 digits only and if so, I loop through every char in the item to see if everyone is a digit using isdigit(). If it is true for every char, I assume it is a date. I created an isdate() method that checks if a date is valid by passing the whole string to it or if only 2 digits are entered (07) then adding it to "01/01/" and passing it. It seems to work. Now I need to check to see if the valid date is older than 3 years from the current date or in a future year (anytime in the future since a license tag cannot have a future date). After a valid year is found, I replace the item's value with "" so it cannot be used again (and you cannot delete items in an array).
Next I need to check for any 2 digit item in the array and see if it matches a valid state abbreviation. I plan to check for the values in the same order the vfp class did.
I'm working my way through year, state, license tag, and location. I have a rule that it can only be a license tag if it is at least 3 characters. Anything less is assumed to be a state. After the year, state and license tag are checked, any item remaining will be put in the location property.
The biggest problem is that the string can be passed in any order. The items in the array may change their order each time. The state could be passed as the 2nd item and then later as the 3rd item.
I didn't write the VFP code. It was written by another programmer who no longer is in our company so I am reading their code and trying to rewrite it. I am just learning C# and working on functions like these to learn it.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement