469,636 Members | 1,555 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,636 developers. It's quick & easy.

Not able to remove blank spaces from string

I'm implementing a feature which reads comma separated txt file from server(one line at a time).

Format of file is fixed, There are 3 columns on each row.

After reading the row from file I insert it in a database table.

But first value of each row aoutomatically appends two blank spaces, even if there are no blank spaces at the begining of each row.

I tried to use "TRIM/LTRIM/Replace" to remove blank spece from the first value of each row, but didn't succeed.

I even tried to use trim in stored procedure itself.

Can you please provide me a work around to remove blank spaces in this scenario.

Thanks in advance
Aug 16 '10 #1
2 1968
Joseph Martell
198 Expert 128KB
Check how you are using your Trim function. The Trim function does not modify the string you call it on. For example:

Expand|Select|Wrap|Line Numbers
  1. Dim aString As String = "   Example of String  _   "
  2. aString.Trim()    'does not modify value of aString
  3.  
In order to get the Trim to stick, you have to assign the result of the Trim() operation:

Expand|Select|Wrap|Line Numbers
  1. aString = aString.Trim()
If this doesn't work, post your code as you are currently using it so we can see exactly what isn't working.
Aug 17 '10 #2
Dear Joseph,

Thanks for your reply.

I solved it, Actually, I was using VbCrlf after each row, this was causing the issue, I have removed VbCrlf and I am not having blank spaces after each row.

Thanks again.

Swapnil
Sep 1 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by ShaeMills via AccessMonster.com | last post: by
KeredDrahcir
1 post views Thread by KeredDrahcir | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.