PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 25 → WX - Verifica se senha possui só letras e numeros e não caracteres especiais.
WX - Verifica se senha possui só letras e numeros e não caracteres especiais.
Débuté par adrianoboller, 19 mai 2015 17:02 - 1 réponse
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 19 mai 2015 - 17:02
//Verifica
IF EDT_LoginSenha <> ""

sCaracter is string = ""

x is int = 0

ResultadoInicial is boolean = False
ResultadoFinal is boolean = True

LOOP (Length(EDT_LoginSenha))

x += 1

sCaracter = Middle(EDT_LoginSenha,x,1)

ResultadoInicial = (sCaracter IN(1,2,3,4,5,6,7,8,9,0,"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y","z","w","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z","W"))

IF ResultadoInicial = False THEN
ResultadoFinal = False
END

END

IF ResultadoFinal = False THEN
Info("Caracter Inválido redefina outra senha.")
EDT_LoginSenha = ""
END

END
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 19 mai 2015 - 17:21
http://doc.windev.com/en-US/?3024032

// Check an email address
IF MatchRegularExpression(MyEmail, "[-.a-z0-9]+[@][-.a-z0-9]+[.][a-z]{2,4}") = True THEN
// "[-.a-z0-9]+": string containing 1 or more characters
// This string can contain letters from 'a' to 'z',
// digits from '1' to '9', and the '-' and '.' symbols
// [.] indicates that this character must correspond to a dot.

// "[a-z]{2,4}": string containing 2, 3 or 4 characters
// This string can contain letters from 'a' to 'z'
Info("The email address: " + MyEmail + " is correct.")
END

// Extract the different elements from a date
// whose format is DD/MM/YYYY (for example: 28/03/2003)
MyDate is string = "28/03/2003"
MyDay, MyMonth, MyYear are strings
IF MatchRegularExpression(MyDate, "([0-9]+)/([0-9]+)/([0-9]+)", ...
MyDay, MyMonth, MyYear) = True THEN
Trace(MyDay, MyMonth, MyYear)
ELSE
Error("The date format is invalid")
END

// Extraction variables
ADay is string
AMonth is string
AYear is string
ATime is string
DateToCheck is string = "Tue, 11 Apr 2006 18:25:09 +0200"
IF MatchRegularExpression(DateToCheck, ...
"[A-Za-z]{3,3}[,] ([0-9]{1,2}) ([A-Za-z]{3,3}) " +...
"([0-9]{4,4}) ([0-9]{2,2}[:][0-9]{2,2}[:][0-9]{2,2}) [\+][0-9]{4,4}", ...
ADay, AMonth, AYear, ATime) = False THEN
Info("Invalid date")
ELSE
Info("Valid date", "Day: " + ADay," Month:" + AMonth, "Year: " + AYear, "Time: " + ATime)
END


Diff, R1, R2 are real
Diff = 0.00001
IF Abs(1-(R1/R2)) < Diff THEN
// R1 and R2 are equal
ELSE
// R1 and R2 are different
END

MyArray is array of 5 strings
I is int
MyArray[1] = "Smith"
MyArray[2] = "Aida"
MyArray[3] = "Parapoline"
MyArray[4] = "Moulin"
MyArray[5] = "Clark"
FOR I = 1 TO 5
IF "B" < MyArray[I] <= "M" THEN Trace(MyArray[I])
// Displays Smith and Clark
END

// Declare the structures
O is ST1
P is ST2

// Declare and instantiate the dynamic structures
P1 is dynamic structure ST1
P1 = O
P2 is dynamic structure ST2
P2 = O

// Comparison
IF P1 = P2 THEN ...


Object1 is dynamic Class1
Object2 is dynamic Class2
BufferObject1, BufferObject2 are Buffers

Object1 = new Class1
Object2 = new Class2

Serialize(Object1, BufferObject1, psdBinary)
Serialize(Object2, BufferObject2, psdBinary)

IF BufferObject1 = BufferObject2 THEN
// True if the two instances have identical contents
ELSE
// False if at least one member is different
END


MyValue is int
MyResult is boolean
MyValue = 10
MyResult = (MyValue IN(1,4,6,10))


MyValue is int
MyOtherValue is int
MyResult is boolean
MyValue = 10
MyOtherValue = 15
MyResult = (MyValue IN(1,4,6,10,MyOtherValue))


The following characters can also be used IN the format:

TAB to check the presence of a tabulation. For example:
MatchRegularExpression(sString, "1" + TAB + "2")
CR to check the presence of a Carriage RETURN. For example:
MatchRegularExpression(sString, "1" + CR + "2")

http://doc.windev.com/en-US/?3024015