Listado de comandos para trabajar con cadenas
Aqui adjunto un listado de comandos para trabajar con cadenas que he encontrado... esta en inglés, si alguien no lo entiende, que me lo comente y lo traduzco, ok?
Espero que os sirva.
<text1> + <text2> return <text1text2>
<text1> - <text2> return <text1text2> with any spaces from <text1> removed and added to the end of the result. An unusual function but sometimes useful.
<text1> $ <text2> return .T. if <text1> exists in <text2>
ALLTRIM(<text>) return <text> with all leading and trailing spaces removed. In VFP 9 this function can remove characters other than spaces by specifying an extra parameter.
AT(<char>,<text>) return the position of character <char> in string <text> or 0 if <char> is not found. The RAT() function does the same but starting at the end of the target string <text>.
ATC(<char>,<text>) this is identical to to the AT() function but it is not case-sensitive.
CTOD(<text>) return <text> as a variable in date format. Note that the CTOD function will fail if STRICTDATE is set to 2.
DTOC(<date>) return <date> as a string in 'dd/mm/yy' or 'dd/mm/yyyy' format depending on the state of SET CENTURY and SET DATE.
DTOS(<date>) return <date> as a variable of type string in 'yyyymmdd' format. Use the DTOS function when you are wanting to index on an expression like Surname + DTOS(DateOfBirth).
FILETOSTR(<filename>) return a string holding the contents of the file named <filename>. Useful in combination with STRTOFILE because you can read a file from disk into memory, process it very quickly, and then write it back out to disk. The only limitation in the 16Mb limit on FoxPro string variables.
ISALPHA(<text>) return .T. if the first character of <text> is alphabetic.
ISLOWER(<text>) return .T. if the first character of <text> is lower case.
ISUPPER(<text>) return .T. if the first character of <text> is upper case.
LEFT(<text>, <n>) return the leftmost <n> characters of <text>. Note that this will include any spaces.
LEN(<text>) return the length of <text> - including spaces. Remember this when you are getting the length of data retrieved from a field.
LIKE(<text1>, <text2>) compares <text1> and <text2> character by character and returns .T. if they match. <text1> can include the wild cards '*' and '?'.
LOWER(<text>) return <text> as text in lowercase.
LTRIM(<text>) return <text> with the leading spaces removed.
OCCURS(<text1>, <text2>) return the number of times that the <text1> occurs in <text2>.
PADC(<text>, <n>, <char>) pad <text> to <n> characters long by adding equal numbers of <char> to both ends.
PADL(<text>, <n>, <char>) pad <text> to <n> characters long by adding <char> to the start.
PADR(<text>, <n>, <char>) pad <text> to <n> characters long by adding <char> to the end.
PROPER(<text>) return <text> in lowercase text with the initial letters capitalised. Not as useful as you might think because many proper names include a mixture of uppercase and lowercase letters which must be retained - "McDonald" and "IBM" for example.
RIGHT(<text>, <n>) return the rightmost <n> characters of <text>. Remember that the count of <n> will include trailing spaces.
RTRIM(<text>) return <text> with the trailing spaces removed.
STR(<number>,<m>,<n>) return <number> as a string of <m> characters rounded to <n> decimals.
STREXTRACT(<text>, <begin>, <end>) returns the characters between the delimiters <begin> and <end> inside <text>. Additional parameters let you distinguish between multiple occurences of the delimiters and choose whether the delimiters are included in the text which is to be returned. The StrExtract function is very useful when processing HTML and XML.
STRTOFILE(<filename>) write a string to a file and return the number of bytes written. Useful in combination with FILETOSTR because you can read a file from disk into memory, process it, and write it back out to disk.
STRTRAN(<text>, <a>, <b>) replace every occurrence of <a> inside <text> with another character or characters <b>.
STUFF(<text>, <m>, <n>, <a>) replace <n> characters from position <m> in <text> with the character or characters <a>.
TRIM(<text>) identical to RTRIM.
SUBSTR(<text>,<m>,<n>) return <n> characters from within <text> starting at character <m>.
UPPER(<text>) return <text> in upper case text.