PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Complete (Function) Left
Complete (Function) Left
Débuté par marcov, 07 mai 2024 18:33 - 6 réponses
Membre enregistré
56 messages
Posté le 07 mai 2024 - 18:33
hi,
How can I complete a string but from the left?

thanks
Membre enregistré
59 messages
Popularité : +2 (2 votes)
Posté le 10 mai 2024 - 11:38
Procedure LeftComplete(sInitialString is string, nFinalLenght is int)

RESULT Complete("",nFinalLenght-Length(sInitialString))+sInitialString
Membre enregistré
24 messages
Posté le 14 mai 2024 - 00:48
If only the Complete function had a parameter to complete on the left!
Posté le 28 mai 2024 - 18:06
Here's how it can be done using built in functions:

StringReverse(Complete(StringReverse("TEST_STRING"), 25, "A"))


This will return "AAAAAAAAAAAAA_TEST_STRING"


BR
Posté le 15 juillet 2024 - 12:47
A1 is string = "SANJOG"

A2 is string = RepeatString("0", Max(0, 10 - Length(A1))) + A1

Output : A2 = "0000SANJOG"

(You can change according to your requirement)
"0" = Padding element
10 = limit for string length
Membre enregistré
2 messages
Posté le 15 juillet 2024 - 13:05
A1 is string = "SANJOG"

A2 is string = RepeatString("0", Max(0, 10 - Length(A1))) + A1

Output : A2 = "0000SANJOG"

(You can change according to your requirement)
"0" = Padding element
10 = limit for string length
Membre enregistré
5 messages
Popularité : +1 (1 vote)
Posté le 09 août 2024 - 02:51
a1 is string = "123"
a2 is string = "0000000000"
right( a2+a1, 10 )

"0000000123"

--
Alex Solares