Database development and training for Birmingham and the midlands
Specialists in Microsoft Access and Visual Foxpro database training and development
I am happy to hear from existing clients but I am taking no new calls.
Visual Basic and Visual FoxPro functions to manipulate characters
VBAMid() |
VFPStuff(), ChrTran(), StrTran() |
Visual Basic Syntax Notes
In VBA you can use the Mid() function to extract one or more characters from inside another string or to change those characters.
Visual FoxPro Syntax Notes
VFP has three functions to do a similar job.
The Stuff() function stuffs characters into a string. You can specify where the new characters should be put and how many of the original characters are to be replaced. As an example:
will produce the string "ABXXXCDEFGHABCDEFGH". The function has inserted the new characters "XXX" into the original string at position 3 and has replaced none of the existing characters.
The StrTran() function performs a string translation. It replaces each occurrence of one character or string inside a string with another character or string. The expression:
will replace every occurrence of the string "D" with the string "XXX" and produce ABCXXXEFGHABCXXXEFGH.
The ChrTran() function is similar. It replaces each occurrence of one character inside a string with the matching character from another string. The expression:
will replace every "A" with "a" and every every "E" with "e".