修剪额外的字符??? [英] Triming extra characters ???

查看:58
本文介绍了修剪额外的字符???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


我有一个csv文件,其输出如下:

" REC00001.CSV"," Pipe"," 25 x 2.5 mm,LP602,LP602,02/11/2004 15:15:04


我需要从该字符串中删除doucble quote char。


为了阅读我的文件,我使用以下代码:


sRead = m_IOStream.ReadLine

'' - 因为它是CSV文件格式,我们需要识别分隔符

字段并将数组中的字符串拆分为准备好的数据


sRead = sRead .Trim(sTrimChar)


请定义我的sTrimChar分隔符以删除我的字符串中的双引号。?

我试过了'''''' ;但它失败了


thnaks为你提供帮助

问候

serge

解决方案

Serge,


尝试以下方法:


sTrimChar =" \"" ;;


问候,

Michael


" serge calderara" < SE ************ @ discussions.microsoft.com> schrieb im

Newsbeitrag新闻:0B ********************************** @ microsof t.com ...

亲爱的,

我有一个csv文件,其输出如下:
" REC00001.CSV"," Pipe" ,25 x 2.5 mm,LP602,LP602,02/11/2004 15:15:04

我需要从该字符串中删除doucble quote char 。

为了阅读我的文件,我使用以下代码:

sRead = m_IOStream.ReadLine
'' - 因为它是CSV文件格式,我们需要识别分隔符
字段并将数组中的字符串拆分为准备好的数据

sRead = sRead.Trim(sTrimChar)

要定义我的sTrimChar分隔符以删除在我的字符串中双引号。?
我试过了''''''但是它失败了

为你提供帮助
问候
哔叽



mihael,


这种语法有什么影响?

特别是\ char,是EScap序列吗?


我用VB .net获取您的信息

但是无论如何我都会试一试


" Michael Groeger"写道:

Serge,

尝试以下方法:

sTrimChar =" \"" ;;

问候,
迈克尔

serge calderara < SE ************ @ discussions.microsoft.com> schrieb im
Newsbeitrag新闻:0B ********************************** @ microsof t.com。 ..

亲爱的,

我有一个csv文件,其输出如下:
" REC00001.CSV"," Pipe"," 25 x 2.5 mm,LP602,LP602,02/11/2004 15:15:04

我需要从该字符串中删除doucble quote char。

为了阅读我的文件,我使用以下代码:

sRead = m_IOStream.ReadLine
'' - 因为它是CSV文件格式,我们需要识别分隔符
字段并将数组中的字符串拆分为准备好的数据

sRead = sRead.Trim(sTrimChar)

要定义我的sTrimChar分隔符以删除我的双引号我试过''''''但是它没有给你提供帮助


哔叽




< blockquote>请注意,Trim函数只会从字符串的开头和结尾删除

中的字符。


如果你想删除所有出现的字符串试试这个:试试这个:


sRead = sRead.Replace("""",String.Empty)


请注意,上面的第一个参数有4个引号。


可能有其他方法可以做到这一点,具有更好的性能。


Chris


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

解决方案

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


这篇关于修剪额外的字符???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆