FIX: Error Using Trimcrlf Method of _stringlib Class (186912)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q186912 SYMPTOMS
When using the Trimcrlf method of the _stringlib class, one of the
following error messages appear:
Variable 'CR' is not found
_STRINGLIB1
ERROR: 12
Method: trimcrlf
Line: 6
DO WHILE (LEFT(lcString,1)==CR OR LEFT(lcString,1)==LF
-or-
Variable 'LF' is not found
_STRINGLIB1
ERROR: 12
Method: trimcrlf
Line: 6
DO WHILE (LEFT(lcString,1)==CR OR LEFT(lcString,1)==LF
CAUSE
This behavior occurs because the variables CR and LF have not been defined
in the Trimcrlf method of the _stringlib class.
RESOLUTION
The _stringlib class is contained in the _utility class library
(_utility.vcx) located in the \ffc subdirectory of the Visual FoxPro
installation directory. Open the _utility class library and select the
_stringlib class. Select the Trimcrlf method and change the code to read as
follows:
LPARAMETERS tcstring,tltrimleft,tltrimright
#DEFINE CR CHR(13)
#DEFINE LF CHR(10)
LOCAL lcstring
lcstring=tcstring
IF tltrimleft
DO WHILE LEFT(lcstring,1)==CR OR LEFT(lcstring,1)==LF
lcstring=LTRIM(SUBSTR(lcstring,2))
ENDDO
ENDIF
IF tltrimright
DO WHILE RIGHT(lcstring,1)==CR OR RIGHT(lcstring,1)==LF
lcstring=TRIM(LEFT(lcstring,LEN(lcstring)-1))
ENDDO
ENDIF
RETURN lcstring
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
Modification Type: | Minor | Last Reviewed: | 3/1/2005 |
---|
Keywords: | kbBug kbfix kbVS600sp3fix KB186912 |
---|
|