Data Access Worldwide Knowledge Base

Article ID 2300
Article Title INFO: Trim removes my tab character, why?
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2300
KBase Category DATAFLEX (GENERAL)
Date Created 03/28/2007
Last Edit Date 04/05/2007


Article Text
PROBLEM:
I noticed that a TRIM function not only removes my leading and trailing spaces but also removes leading and trailing tab characters. Why is that?

ANSWER:
A tab character is considered white space and removed by the TRIM function like a space. Other characters that are white space are: 0x0A 0x0B 0x0C and ox0D.

In the following test routine the length of the string before trimming is 8 bytes and after trimming it is 2 bytes.

Procedure Test
    String sData
    
    Move ("AB" + Character ($09)) To sData // Tab
    Move (sData + Character ($0A)) To sData // LF
    Move (sData + Character ($0B)) To sData // VT
    Move (sData + Character ($0C)) To sData // FF
    Move (sData + Character ($0D)) To sData // CR
    Move (sData + Character ($20)) To sData // Space
    
    Showln (Length (sData))
    Move (Trim (sData)) To sData
    
    Showln (Length (sData))
End_Procedure

Which characters are considered white space can be changed via the dfconfig utility. The result of this utility is written to an INI file (usually DFINI.CFG) and loaded at startup of the program/runtime. The configuration information can be loaded too with the Read_Dfini command.


Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu


Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.