Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting other software...
Message
De
16/01/2004 16:50:39
 
 
À
16/01/2004 16:44:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00867610
Message ID:
00867684
Vues:
32
>P.S. An unrelated q. Is there an easy way to invert a char. string? i.e. 'ABCD' to 'DCBA'.

does this work for you? (needs foxtools.fll loaded)
clear

?ReverseStr("Gunnar", 1)

FUNC ReverseStr
	PARA;
		StrToReverse;
		StrDelimiter
	LOCAL ;
		NewString, ;
		i

	NewString = ""
	IF TYPE("StrDelimiter") = "N"
		FOR i=1 TO LEN(StrToReverse) STEP StrDelimiter
			NewString = SUBS(StrToReverse, i, StrDelimiter) + NewString
		ENDFOR
	ELSE
		FOR i=1 TO words(StrToReverse, StrDelimiter)
			NewString = ALLT(wordnum(StrToReverse, i, StrDelimiter)) + NewString
		ENDFOR
		NewString = STRTRAN(NewString, StrDelimiter, "")
	ENDIF
	RETURN(NewString)
ENDFUNC
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform