473,811 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Not able to remove blank spaces from string

41 New Member
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 2196
Joseph Martell
198 Recognized Expert New Member
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
SwapnilD
41 New Member
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

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

Similar topics

9
6697
by: Jean-Marc Molina | last post by:
Hello, I can't find a way to execute a Windows application, whose directory path contains blank spaces, from a PHP script. I also wonder if the problem happens under Linux and other OS. Working dir : "C:\test copy" "copy.php" PHP script : <?php
1
4088
by: Danny | last post by:
Given this: "*" the pattern to remove the htnl code between brackets, how can I remove a series of spaces and just make one space. like here is a series of blank spaces thanks
1
1784
by: macupryk | last post by:
-- _list Count = 13 System.Collections.ArrayList + {QUEST} object {System.Data.DataColumn} + {S_DAT} object {System.Data.DataColumn} + {NAME } object {System.Data.DataColumn} + {INTRO} object {System.Data.DataColumn} + {PART } object {System.Data.DataColumn} + {INT00} object {System.Data.DataColumn} + ...
3
8809
kamill
by: kamill | last post by:
how can i remove blank spaces from text file......is there any function to remove a perticular chr from file...
3
3755
by: metalinc | last post by:
hi! i need help in C programming to TRIM BEGINNING and END BLANK spaces in STRING.....
3
3778
by: ShaeMills via AccessMonster.com | last post by:
In my table I imported from .txt, one of my columns has blank spaces. The column is as follows, how do I eliminate the blank spaces in between the second and third, and fifth and sixth digits? 12 345 6789 78 241 5869 04 258 3695 14 254 1136 00 045 0285
1
3330
by: maryanncanor | last post by:
Hi everyone, My problem is whenever I export a report to a textfile. The output textfile have blank spaces. Here is my query: SELECT ( & '|' & & '|' & ......................and so on .........................AS EXPR1 FROM ;
2
9944
by: Marvstyles | last post by:
How would i check a string for blank spaces and if there is more than one blank space between two words, how would i convert it into just one blank space between the words? Another question i have is.. how would u check a string to see if its a valid floating point-number?
1
1763
KeredDrahcir
by: KeredDrahcir | last post by:
I have some values in an array and I need to remove the blank spaces before them. I've used array_walk($context_array, 'trim_value');To trim the spaces using the function: function trim_value(&$value) { $value = trim($value, "\xC2\xA0"); } This seems to have no effect. I need to convert my values into an array of single characters. I don't have PHP 5 so I've used a function to do the same job as str_split.
9
10012
by: madhuriks | last post by:
hi, i tried to delete an element in xml..for that i used servlet coding...it is getting deleted but blank spaces are remaining i dont want that blank spaces..can any one do me needfull..here is my code.. its urgent private void delNode(java.io.File file, Document parent, String filtervalue) throws Exception { NodeList nodeList = parent.getElementsByTagName("PACK_NAME");
0
9730
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10403
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.