General information
Category:
Coding, syntax & commands
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?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only