Porblem in reading Chr(0)

G

Guest

Hai Guys,
I'm facing a problem in reading the file values. When the record contains
the Chr(0) i can get the value till Chr(0). After Chr(0), I'm unable to get
the value. It's getting truncated.
When I tried with Console Application and tried to print it out, It's
working perfect. But when I'm using the Web Services to access the same
function, it's not getting the value.
Please help it's very urgent
Regards,
Venki
 
J

Jon Skeet [C# MVP]

Venki said:
I'm facing a problem in reading the file values. When the record contains
the Chr(0) i can get the value till Chr(0). After Chr(0), I'm unable to get
the value. It's getting truncated.
When I tried with Console Application and tried to print it out, It's
working perfect. But when I'm using the Web Services to access the same
function, it's not getting the value.

I'm sure it *is* getting the value - it's that whatever you're then
*doing* with it is stripping it or doesn't know how to handle it.
 
G

Guest

Hai Jon,
Welcome back.
Both of use discussed the same topic a month ago. I'm still not rectified
it. As You said, I tried with a Console Application. The value are getting
fine. It's displaying the string what I want. I have a string like below

234mat1cat456bat'0'rat - let's assume this the whole string '0' represent
Chr(0) in the file
lsStr = "234mat1cat456bat'0'rat"
I first extracted mat and cat. I want to extract bat and rat. I used the
following to extract.

checkString = Mid(lsStr,1,10) - it gave the first part. Working perfectly.

But when I tried to execute following the problem started.
checkString = mid(lsStr,11) - it gave as "456 - not even end quotes

When I tried with following logic to read, ot gave a empty string or it
passes a empty string

extStr = Mid(checkString,4) - it has to extract bat'0'rat. But it is not.
I'm using Web Services to read the file. Please help. It's very urgnt.

Regards,
Venkatarajan
 
J

Jon Skeet [C# MVP]

Venki said:
Welcome back.
Both of use discussed the same topic a month ago. I'm still not rectified
it. As You said, I tried with a Console Application. The value are getting
fine. It's displaying the string what I want. I have a string like below

234mat1cat456bat'0'rat - let's assume this the whole string '0' represent
Chr(0) in the file
lsStr = "234mat1cat456bat'0'rat"
I first extracted mat and cat. I want to extract bat and rat. I used the
following to extract.

checkString = Mid(lsStr,1,10) - it gave the first part. Working perfectly.

But when I tried to execute following the problem started.
checkString = mid(lsStr,11) - it gave as "456 - not even end quotes

That sounds like a display problem again, rather than an actual strange
string.
When I tried with following logic to read, ot gave a empty string or it
passes a empty string

extStr = Mid(checkString,4) - it has to extract bat'0'rat. But it is not.
I'm using Web Services to read the file. Please help. It's very urgnt.

Rather than using Mid, try using the standard .NET string manipulation
methods - Substring etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top