Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP & VB command comparison?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00131782
Message ID:
00133772
Vues:
14
This is where VFP wins hands down. In these cases, you will need to loop through the character string byte by byte - and rebuild the string - based on what you need to replace each character with.

Here is a VB function that will work for you since you are doing a simple - 1 character replacement:

Function strtran(csearched As String, csearchfor As String, creplacement As String) As String
Dim x As Integer
x = 0
For x = 1 To Len(csearched)
If Mid(csearched, x, 1) = csearchfor Then
strtran = strtran + creplacement
Else
strtran = strtran + Mid(csearched, x, 1)
End If
Next x
End Function



>>VFP on the whole, has a much richer language - particulary in the string
>>manipulation and data manipulation arena.
>
>Speaking of which, I was trying to write an Append Query in Access the other day and assign cField to cDescription, and STRTRAN(cField, ' ', '_') to cPrimaryKey. Of course, Access doesn't support STRTRAN, so I ended up leaving the spaces in, which is not a wholly satisfactory solution. Any ideas?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform