Re: Trim() does not work with Tab charachters



The VBA Replace function would be easier.

Here is an example (with your trim problem), it replaces all tabs with
spaces and the tabs before or after the string will be stripped by the Trim

Dim str As String

str = vbTab & "john" & vbTab & vbTab
Debug.Print "["; str; "]"

str = Trim(str)
Debug.Print "["; str; "]"

str = Trim(Replace(str, vbTab, " "))
Debug.Print "["; str; "]"

John... Visio MVP

"Dennis" <Dennis@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F971A13A-A49C-48C9-A11B-504F15857320@xxxxxxxxxxxxxxxx
Well, you COULD use INSTR to see if there are any Tabs, and then spin
through
the string and remove them.



.



Relevant Pages

  • Re: string trim problem
    ... > from a string (tabs should remain in place). ... the string is not being modified. ... the obvious: $newStr is equal to $str: ...
    (comp.lang.tcl)
  • Re: Unwanted Spaces and Iterative Loop
    ... This looks like a CSV file using tabs as the separator. ... first after a very minimal set of string ... for line in inHandler: ... manipulations, replacing chunks of text with or without tabs or commas to ...
    (comp.lang.python)
  • Re: Converting a CSV text file
    ... It would display in a list box, ... ' The number of tabs ... Private Sub Form_Load ... Take the string and replace the comma's... ...
    (microsoft.public.vb.general.discussion)
  • Re: Storing array elements tab delimitered in a string
    ... delimitered in a string (need to prepare collected data for import ... if your fields can contain quotes *and* tabs. ... tabs as field separators, quote marks as string delimiters, etc. - ...
    (comp.lang.perl.misc)
  • Re: RubyDictionary - First Try
    ... what I mean is that the client can modify the String object after ... You surely mean the DictionaryEntry ... the typical convention is to use two spaces instead of tabs. ...
    (comp.lang.ruby)