Dear all,
I have a csv file which as following output :
"REC00001.CSV","Pipe","25 x 2.5 mm","LP602","LP602","02/11/2004 15:15:04"
I need to remove from that string doucble quote char.
In order to read my file I use following code :
sRead = m_IOStream.ReadLine
'- as it is a CSV file format, we need to identify the separator
field and split the string in array for ready data
sRead = sRead.Trim(sTrimChar)
HOw to define my sTrimChar delimiter to remove double quote in my string.?
I have tried "''" but it fails
thnaks for your help
regards
serge 11 2273
Serge,
try the following:
sTrimChar = "\"";
Regards,
Michael
"serge calderara" <se************@discussions.microsoft.com> schrieb im
Newsbeitrag news:0B**********************************@microsof t.com... Dear all,
I have a csv file which as following output : "REC00001.CSV","Pipe","25 x 2.5 mm","LP602","LP602","02/11/2004 15:15:04"
I need to remove from that string doucble quote char.
In order to read my file I use following code :
sRead = m_IOStream.ReadLine '- as it is a CSV file format, we need to identify the separator field and split the string in array for ready data
sRead = sRead.Trim(sTrimChar)
HOw to define my sTrimChar delimiter to remove double quote in my string.? I have tried "''" but it fails
thnaks for your help regards serge
mihael,
What effect does that syntax does ?
especailly the \ char, is it EScap sequence ?
I am using VB.net for your info
But I will give a try anyway
"Michael Groeger" wrote: Serge,
try the following:
sTrimChar = "\"";
Regards, Michael
"serge calderara" <se************@discussions.microsoft.com> schrieb im Newsbeitrag news:0B**********************************@microsof t.com... Dear all,
I have a csv file which as following output : "REC00001.CSV","Pipe","25 x 2.5 mm","LP602","LP602","02/11/2004 15:15:04"
I need to remove from that string doucble quote char.
In order to read my file I use following code :
sRead = m_IOStream.ReadLine '- as it is a CSV file format, we need to identify the separator field and split the string in array for ready data
sRead = sRead.Trim(sTrimChar)
HOw to define my sTrimChar delimiter to remove double quote in my string.? I have tried "''" but it fails
thnaks for your help regards serge
Be aware that the Trim function will only remove the characters from
the beginning and end of the string.
If you wish to remove all occurences of the quotation mark, try this:
sRead = sRead.Replace("""",String.Empty)
Note that the first argument above has 4 quotation marks.
There may be other ways to do this that have better performance.
Chris
Be aware that the Trim function will only remove the characters from
the beginning and end of the string.
If you wish to remove all occurences of the quotation mark, try this:
sRead = sRead.Replace("""",String.Empty)
Note that the first argument above has 4 quotation marks.
There may be other ways to do this that have better performance.
Chris
If you have a small budget, but at least a budget, my suggestion is to
actually buy a package to handle all this nastiness for you instead of
trying to guess at the proper handling because at best, you'll do it
very inefficiently, and at worse, you'll do it inefficiently and
incorrectly. As for the answer to your question, if you're just bound
and determined to do it wrong, split on a comma, then on each value in
the array, you'd want to trim ", but then replace "" with ". Even at
that, you're breaking atleast 3 rules of csv parsing.
Serge,
yes \ is a escape sequence in c#/c++. I think the way Chris does it is the
best. He's also correct that Trim() only trims the leading and trailing
characters. Sorry, I forgot that one...
Regards,
Michael
"serge calderara" <se************@discussions.microsoft.com> schrieb im
Newsbeitrag news:CA**********************************@microsof t.com... mihael,
What effect does that syntax does ? especailly the \ char, is it EScap sequence ?
I am using VB.net for your info But I will give a try anyway
"Michael Groeger" wrote:
Serge,
try the following:
sTrimChar = "\"";
Regards, Michael
"serge calderara" <se************@discussions.microsoft.com> schrieb im Newsbeitrag news:0B**********************************@microsof t.com... Dear all,
I have a csv file which as following output : "REC00001.CSV","Pipe","25 x 2.5 mm","LP602","LP602","02/11/2004
15:15:04" I need to remove from that string doucble quote char.
In order to read my file I use following code :
sRead = m_IOStream.ReadLine '- as it is a CSV file format, we need to identify the
separator field and split the string in array for ready data
sRead = sRead.Trim(sTrimChar)
HOw to define my sTrimChar delimiter to remove double quote in my
string.? I have tried "''" but it fails
thnaks for your help regards serge
thanks chirs that works
serge
"Chris Dunaway" wrote: Be aware that the Trim function will only remove the characters from the beginning and end of the string.
If you wish to remove all occurences of the quotation mark, try this:
sRead = sRead.Replace("""",String.Empty)
Note that the first argument above has 4 quotation marks.
There may be other ways to do this that have better performance.
Chris
just for my knowlege, why 4 quaotation marks are required and not only the
single " ?
"Chris Dunaway" wrote: Be aware that the Trim function will only remove the characters from the beginning and end of the string.
If you wish to remove all occurences of the quotation mark, try this:
sRead = sRead.Replace("""",String.Empty)
Note that the first argument above has 4 quotation marks.
There may be other ways to do this that have better performance.
Chris
just for my knowlege, could you explain me why the proposiion of chris is not
suitable?
I means what rules are you talking about, I am interresting to know?
"shriop" wrote: If you have a small budget, but at least a budget, my suggestion is to actually buy a package to handle all this nastiness for you instead of trying to guess at the proper handling because at best, you'll do it very inefficiently, and at worse, you'll do it inefficiently and incorrectly. As for the answer to your question, if you're just bound and determined to do it wrong, split on a comma, then on each value in the array, you'd want to trim ", but then replace "" with ". Even at that, you're breaking atleast 3 rules of csv parsing.
Serge,
that's how vb.net escapes double quotes.
Regards,
Michael
"serge calderara" <se************@discussions.microsoft.com> schrieb im
Newsbeitrag news:D4**********************************@microsof t.com... just for my knowlege, why 4 quaotation marks are required and not only the single " ?
"Chris Dunaway" wrote:
Be aware that the Trim function will only remove the characters from the beginning and end of the string.
If you wish to remove all occurences of the quotation mark, try this:
sRead = sRead.Replace("""",String.Empty)
Note that the first argument above has 4 quotation marks.
There may be other ways to do this that have better performance.
Chris
Trimming quotes from the beginning and end of a column will remove the
quotes even if they're supposed to be there, like on a column "Mary
said, ""Go away!""". Splitting on a comma will mess up columns with
commas in them, like "$100,000". Using ReadLine will mess up columns
that can contain carriage returns and new line characters in the data,
which is completely valid as long as they're contained in text qualifed
data using quotes. In quite a few instances, leading and trailing white
space in non text qualified data should be trimmed. These rules are
very valid, and are why I'd suggest not making your own csv parsing
routines, and instead just buying a parser where someone has already
done all this work for you, and most likely, a lot more efficiently
since they weren't under a deadline restriction to just get something
that kind of works out.
Here's a site that I consider pretty decent describing some of the de
facto standard rules of csv data. http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sidharta |
last post by:
Hi all,
how come this doesn't work?????
# convert to unix new lines
$text = preg_replace("/\r\n/", "\n", $text);
# remove extra new lines
$text = preg_replace("/\n+/", "\n", $text);
is...
|
by: serge calderara |
last post by:
Dear all,
I have a csv file which as following output :
"REC00001.CSV","Pipe","25 x 2.5 mm","LP602","LP602","02/11/2004 15:15:04"
I need to remove from that string doucble quote char.
In...
|
by: santosh |
last post by:
Hi,
A book that I'm currently using notes that the fgets() function does
not
return until Return is pressed or an EOF or other error is encountered.
It then at most (in the absence of...
|
by: ricky |
last post by:
Can anybody help with the function to get rid of extra characters in
the file.
I want to remove the string from the file.So i read from input file and
pass the string say "john" if found dnt write...
|
by: dwaldman |
last post by:
If i have the following recordset:
<td><font size="1"><%= (rsT.Fields.Item("ASC_Name").Value)
%></font></td>
Which in live data displays Direct Wireless for example, how would I
trim that...
|
by: acarroll |
last post by:
We're currently using Sharepoint to pull data into Access, so our tables are linked. In our tables in Access we are getting extra characters (;#) in our data that needs to be removed. I'm assuming...
|
by: Michel Vanderbeke |
last post by:
Hello,
I would like to create a textbox with extra properties where I can choose if
the textbox may contain only numbers, only letters, both, punctuation marks
etc.
Can anyone help me with tips...
|
by: =?Utf-8?B?YmJkb2J1ZGR5?= |
last post by:
Hi,
I am retrieving data from a binary field from a sql table and I am having a
problem with extra characters being tacked onto the end. The thePass
variable has some unknown spaces after it...
|
by: webqueen79 |
last post by:
When I open up my asp code in an editor, I see TONS of extra whitespace between code lines which is making the editor bomb out because it takes so long to load all the lines. When I open up the asp...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |