如何以一种向我显示NullChars的方式打开文件? [英] How can I open a file in a way that'll show me the NullChars?

查看:53
本文介绍了如何以一种向我显示NullChars的方式打开文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Gang,

我想打开我的压缩文档。问题是

的一部分压缩算法包含我需要检测的字符0。 VB

将字符0视为"什么都没有,我什么也找不到,因为5行

连续的字符仍然是"。有没有人知道这方面的方法?

我打开二进制还是什么?如果是这样的话?

先谢谢,

Christian Blackburn

解决方案

嗨基督徒,

I Character" 0"它不是什么都没有,它的字节值是48像字符

" 1"有49.

也许这是你试图评估的二进制值。

我认为你可以用

\\ \\

dim a as char = chr(0)

////

我希望这对你有所帮助。

Cor


您好Cor,

感谢您的帮助。我认为你是对的,我试图检测

Chr(0),我以为那是nullchar,但正如你刚才说的那样'

chr (48)。所以据你所知,我应该能够检测到字符串数据类型中所有256个字符的每个实例

,即使字符串比一个字符更多

?你看,我担心null字符不会被添加到Len()值中。我的假设是正确的吗?

再次感谢,

Christian

" Cor" < no*@non.com>在消息中写道

news:3f ********************** @ reader20.wxs.nl ...

嗨基督徒,
我的性格0并不是什么,它具有字符值48,如字符
1。已经49.
也许这是你试图评估的二进制值。
我认为你可以用
\\\\
dim a as char = chr(0)
////
我希望这会对你有所帮助。
blockquote>

几乎是基督徒。 Cor给你小骗子但是...


NullChar是Chr(0)。它也就是vbNullChar。


Chr(48)0也称为零。


NullChar'绝对包含在Len()中和.Length值。


< string> .IndexOf(NullChar)将返回字符串中第一次出现

a NullChar的索引或-1如果字符串不包含任何内容。


如果你想摆脱它们,请使用< string> =< string> .Replace(NullChar,"")。

这会将Len()或.Length值减少NullChar的数量
$ b $最初在字符串中的b。


Christian Blackburn <基督教@该死@ SP ** @ Hotmail.com>在消息中写道

news:%2 ****************** @ TK2MSFTNGP11.phx.gbl ...

Cor,
感谢您的帮助。我认为你是对的,我试图检测到Chr(0),我以为那是nullchar,但正如你刚才所说的那样是chr(48)。所以据你所知,我应该能够检测字符串数据类型中所有256个字符的每个实例
,即使字符串有
多个字符?你看我担心null字符不会被添加到Len()值中。我的假设是否正确?
再次感谢,
Christian

" Cor" < no*@non.com>在消息中写道
新闻:3f ********************** @ reader20.wxs.nl ...

你好Christian,
I Character" 0"它不是什么都没有,它的字节值就像
字符1一样。已经49.
也许这是你试图评估的二进制值。
我认为你可以用
\\\\
dim a as char = chr(0)
////
我希望这会对你有所帮助。
blockquote>


Hi Gang,
I would like to open a compressed document of mine. The problem is part of
the compression algorithm contains character 0 which I need to detect. VB
sees character 0 as "" nothing and I can''t detect nothing because 5 null
characters in a row would still be "". Does anyone know a way around this?
Do I open as binary or what? If so how?
Thanks in Advance,
Christian Blackburn

解决方案

Hi Christian,
I Character "0" is not nothing, it is has the byte value 48 like character
"1" has 49.
Maybe it is the binary value 0 you try to evaluate.
That I think you can reach with
\\\\
dim a as char = chr(0)
////
I hopes this helps you a little bit.
Cor


Hi Cor,
Thanks for the help. I think you are right that I was trying to detect
Chr(0), I assumed that was the nullchar, but as you have just said it''s
chr(48). So as far as you know I should be able to detect each instance of
all 256 characters within the string datatype even when the string has more
than one character? You see I''m worried that the null characters won''t be
added to the Len() value. Is my assumption correct?
Thanks again,
Christian
"Cor" <no*@non.com> wrote in message
news:3f**********************@reader20.wxs.nl...

Hi Christian,
I Character "0" is not nothing, it is has the byte value 48 like character
"1" has 49.
Maybe it is the binary value 0 you try to evaluate.
That I think you can reach with
\\\\
dim a as char = chr(0)
////
I hopes this helps you a little bit.
Cor



Nearly Christian. Cor put you little crook but ...

NullChar is Chr(0). It is aka vbNullChar.

Chr(48) is 0 aka Zero.

NullChar''s are definitely included in the Len() and .Length values.

<string>.IndexOf(NullChar) will return the index of the first occurrence of
a NullChar in the string or -1 if the string does not contain any.

If you want to get rid of them use <string> = <string>.Replace(NullChar,"").
This will reduce the Len() or .Length values by the number of NullChar''s
that were in the string originally.

"Christian Blackburn" <Christian@Damn@Sp**@Hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...

Hi Cor,
Thanks for the help. I think you are right that I was trying to detect
Chr(0), I assumed that was the nullchar, but as you have just said it''s
chr(48). So as far as you know I should be able to detect each instance of all 256 characters within the string datatype even when the string has more than one character? You see I''m worried that the null characters won''t be
added to the Len() value. Is my assumption correct?
Thanks again,
Christian
"Cor" <no*@non.com> wrote in message
news:3f**********************@reader20.wxs.nl...

Hi Christian,
I Character "0" is not nothing, it is has the byte value 48 like character "1" has 49.
Maybe it is the binary value 0 you try to evaluate.
That I think you can reach with
\\\\
dim a as char = chr(0)
////
I hopes this helps you a little bit.
Cor




这篇关于如何以一种向我显示NullChars的方式打开文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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