>One of our clients wants some reports that come from one of his vendors imported into his database. The reports come in an ASCII file and we use low-level file functions to import the file. The problem is that some times the report has tabs in instead of spaces. Is there a way to figure out how many spaces a tab takes up? Depending on when it tabs the tab could take up 5 spaces to just 1 but how do you know?
Is the file delimited or fixed length? If it is delimited, you might could use strtran() to replace all the tabs with a single space. Otherwise, you may have to keep track of how many characters you import before a tab, then use the mod() function on the length of that string divided by 5. Take the decimal part of the return value remainder, multiply that by 5 to see how many spaces that tab represents.
lnRetVal = mod(len(lcString), 5)
lnDecimal = lnRetVal - int(lnRetVal)
lnSpaces = lnDecimal * 5
lcString = lcString + space(lnSpaces)
You would have to contruct lcString a piece at a time up to each tab found.
Mark McCasland
Midlothian, TX USA