Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Coded by: Willian Luigi
- Date format mask.
- Function: It verify if the string input got a date format, like DD/MM/YYYY.
- - Verifica se a string inserta na função tem o formato data, tipo DD/MM/AAAA.
- Ex:
- 04/04/0004 = true
- 0/04/0 = false
- 04/04/04 = false
- 0404040 = false
- 04/0404 = false
- amlsdaks = false
- DD/MM/AAAA = false
- 2m/2m/20md = false
- /0/203/2 = false
- 0004/04/04 = false
- */
- stock readFormat(reader[])
- {
- if (reader[0] == '\0' || strfind(reader, "/") == -1) return false;
- new
- sS = 0,
- sNextVal[15],
- sOldVal[15],
- sBarFind = 0,
- sV = 2;
- format(sOldVal, 15, "%s/", reader);
- do
- {
- if ((sS = strfind(sOldVal, "/")) != -1)
- {
- sBarFind ++;
- if (sBarFind == 3) sV = 4;
- strmid(sNextVal, sOldVal, 0, sS);
- strmid(sOldVal, sOldVal, sS + 1, strlen(sOldVal));
- if (!strval(sNextVal) || strlen(sNextVal) != sV) return 0;
- }
- } while(sS > 0);
- return sBarFind == 3;
- }
Advertisement
Add Comment
Please, Sign In to add comment