Converting string array to byte array 
Author Message
 Converting string array to byte array

I have a string array that I created using the Split function. I now need to
convert this string array into a byte array. Is there a straightforward way
of doing this? I tried simply make an assignment like so:

byte() = string()

No go. Must one iterate through the string array by each element making a
conversion assignment to the corresponding byte element? Or is there an
easier way of doing this?

Thanks!

JR



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
On Wed, 7 Jun 2000 11:28:08 -0700, "Jerald R. Rawdon Jr."

Quote:

>I have a string array that I created using the Split function. I now need to
>convert this string array into a byte array. Is there a straightforward way
>of doing this? I tried simply make an assignment like so:

>byte() = string()

>No go. Must one iterate through the string array by each element making a
>conversion assignment to the corresponding byte element? Or is there an
>easier way of doing this?

One method is to use two User Defined Types

Type TByteBuffer
         Bytes( 1 to 100 ) as Byte
End Type
Type TStrBuffer
         Str as String * 100
End Type

Dim B as TByteBuffer,  S as TStrBuffer

S.Str = "This is a Unicode String"
LSET B = S

B.Bytes() now contains ASCII string

Note - this only works for *fixed* length strings,

This is another method:

Private Sub Command3_Click()
    Dim B() As Byte
    Dim S$, N$
    S$ = "This is a Test"
    B() = StrConv(S, vbFromUnicode)
    N$ = StrConv(B(), vbUnicode)
    MsgBox N$
End Sub



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
I think you can do this with the Array() function!!!!!!! - I think take a
look in the help

--
Mr Enigma

------------------------------------------



Quote:
> I have a string array that I created using the Split function. I now need
to
> convert this string array into a byte array. Is there a straightforward
way
> of doing this? I tried simply make an assignment like so:

> byte() = string()

> No go. Must one iterate through the string array by each element making a
> conversion assignment to the corresponding byte element? Or is there an
> easier way of doing this?

> Thanks!

> JR



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
If you are not using fixed length strings, this is a silly way of doing
this.  For non-fixed length strings you could simply do this:

Private Sub Form_Load()
   Dim B() As Byte
   Dim S As String

   B = "Hello"
   S = B
End Sub

The original question however was not regarding how to copy fixed length
strings into a byte array.  The question was how do I copy an array of
strings into an array of bytes.  You unfortunately will need to iterate
through the string, compile the string array into a string variable which
you can then assign to the byte array:

Dim S() As String
Dim B() As Byte
Dim Buffer As String

ReDim S(3)
S(0) = "A"
S(1) = "B"
S(2) = "C"
For Idx = LBound(S) To UBound(S) Step 1
   Buffer = Buffer & S(Idx)
Next Idx
' Assign the string to the byte array
B = Buffer


Quote:
> On Wed, 7 Jun 2000 11:28:08 -0700, "Jerald R. Rawdon Jr."

> >I have a string array that I created using the Split function. I now need
to
> >convert this string array into a byte array. Is there a straightforward
way
> >of doing this? I tried simply make an assignment like so:

> >byte() = string()

> >No go. Must one iterate through the string array by each element making a
> >conversion assignment to the corresponding byte element? Or is there an
> >easier way of doing this?

> One method is to use two User Defined Types

> Type TByteBuffer
>          Bytes( 1 to 100 ) as Byte
> End Type
> Type TStrBuffer
>          Str as String * 100
> End Type

> Dim B as TByteBuffer,  S as TStrBuffer

> S.Str = "This is a Unicode String"
> LSET B = S

> B.Bytes() now contains ASCII string

> Note - this only works for *fixed* length strings,

> This is another method:

> Private Sub Command3_Click()
>     Dim B() As Byte
>     Dim S$, N$
>     S$ = "This is a Test"
>     B() = StrConv(S, vbFromUnicode)
>     N$ = StrConv(B(), vbUnicode)
>     MsgBox N$
> End Sub



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
Yes - I mis-read the posting

I assumed the posting was asking about Unicode -> ASCII

However StrConv does work for non fixed length strings - the LSet
example was just interesting.

I guess Brian missed this bit:

        B() = StrConv(S, vbFromUnicode)

There is a danger of using :
     B() = S$
as you get the Unicode 2 byte characters copied to the Byte array
which is not much use if you are planning to send the Byte array to an
API or tinker with the ASCII in the Byte Array

In fact I have never found a meaningful use for Unicode bytes.

On Fri, 09 Jun 2000 03:06:56 GMT, "Brian Griffin"

Quote:

>If you are not using fixed length strings, this is a silly way of doing
>this.  For non-fixed length strings you could simply do this:

>Private Sub Form_Load()
>   Dim B() As Byte
>   Dim S As String

>   B = "Hello"
>   S = B
>End Sub

>The original question however was not regarding how to copy fixed length
>strings into a byte array.  The question was how do I copy an array of
>strings into an array of bytes.  You unfortunately will need to iterate
>through the string, compile the string array into a string variable which
>you can then assign to the byte array:

>Dim S() As String
>Dim B() As Byte
>Dim Buffer As String

>ReDim S(3)
>S(0) = "A"
>S(1) = "B"
>S(2) = "C"
>For Idx = LBound(S) To UBound(S) Step 1
>   Buffer = Buffer & S(Idx)
>Next Idx
>' Assign the string to the byte array
>B = Buffer



>> On Wed, 7 Jun 2000 11:28:08 -0700, "Jerald R. Rawdon Jr."

>> >I have a string array that I created using the Split function. I now need
>to
>> >convert this string array into a byte array. Is there a straightforward
>way
>> >of doing this? I tried simply make an assignment like so:

>> >byte() = string()

>> >No go. Must one iterate through the string array by each element making a
>> >conversion assignment to the corresponding byte element? Or is there an
>> >easier way of doing this?

>> One method is to use two User Defined Types

>> Type TByteBuffer
>>          Bytes( 1 to 100 ) as Byte
>> End Type
>> Type TStrBuffer
>>          Str as String * 100
>> End Type

>> Dim B as TByteBuffer,  S as TStrBuffer

>> S.Str = "This is a Unicode String"
>> LSET B = S

>> B.Bytes() now contains ASCII string

>> Note - this only works for *fixed* length strings,

>> This is another method:

>> Private Sub Command3_Click()
>>     Dim B() As Byte
>>     Dim S$, N$
>>     S$ = "This is a Test"
>>     B() = StrConv(S, vbFromUnicode)
>>     N$ = StrConv(B(), vbUnicode)
>>     MsgBox N$
>> End Sub



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
Hi,

While your observation is absolutely correct that it will copy the high
order bytes into every other element in the byte array,  if you play with
the code:

Dim B() As Byte
Dim S As String

S = "Hello"
B = S

And were to print out B:

Debug.Print B

You would get "Hello" (Minus the quotes of course).  So if JR's intent is to
turn the string array into a string that can be displayed or manipulated as
a string, the call to strconv() actually would have a NEGATIVE impact as
every other character would end up in the high word of a unicode byte and
therefore be inaccessible without more processing.  Furthermore if JR wanted
to convert the byte array back to a string given your algorithm he would
have to call strconv again using vbToUnicode.  If JR did not need the extra
characters parsed out why burn the extra cycles?  Give me simplicity over
complexity any day of the week.

As for your assertion that you have found no use for Unicode strings, you
use them every day that you use VB!  VB strings are actually BSTR's which
encapsulate a unicode string AND are OLE Automation compliant.  BSTR's also
provide for localization as they are internationally aware and they are an
important factor in COM that allows us to declare a string in one component
and pass that string to another component in another process while
effectively managing the memory allocation for that string.  Every time you
write an ActiveX component that exposes a string as a parameter or return
value hail the unicode BSTR for that is what you are using.


Quote:
> Just curious, but why do you want a byte array of unicode words ?

> On Sat, 10 Jun 2000 12:50:20 -0700, "Jerald R. Rawdon Jr."

> >Brian,

> >Thanks for noting what the original question was....your suggestion was
what
> >I was looking for.

> >JR



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
On Thu, 22 Jun 2000 00:09:23 GMT, "Brian Griffin"

Brian,

Point 1.
  He wanted to turn a string array into a Byte array
  He has not explained why

Point 2.
  I am perfectly aware that Unicode enables enhanced
  language support - but since my Korean is a little
  rusty - I see that as pretty pointless.

Point 3.
  I am also aware that VB uses the BSTR, that ActiveX/COM
  uses the BSTR, and that Delphi has a WideString type
  Also that Variant Strings are implementation of the BSTR

  That does NOT however, answer my point about
  "what use is Unicode"
  After all most data lands up on disk as ASCII

I totally agree with you about preferring simplicity over complexity,
and reckon that Unicode is an unnecessary level of complexity.

Incidentally 'Uni' is the Sanscript word for the female {*filter*}ia - an
apt description I think.



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
Well, J. French, you may be as provincial as you like. Those of us who work
in the world and realize it is round see the importance of supporting other
languages, and supporting them in a way that does not require one to have
locale-specific changes on every single compile for each language.

Maybe it takes companies that have more vision to be larger?

Over 60% of Microsoft's products and services are sold outside the US. Can
you say the same? I can't, I'm closer to 40%, but I am working on it!

Maybe you need to think about more than your own backyard in your search for
greatness in VB?

--
MichKa
"Cause it's a bittersweet symphony, thats life..."  -- The Verve

random junk of dubious value, at the multilingual,
no scripts required, http://www.*-*-*.com/


Quote:
> On Thu, 22 Jun 2000 00:09:23 GMT, "Brian Griffin"

> Brian,

> Point 1.
>   He wanted to turn a string array into a Byte array
>   He has not explained why

> Point 2.
>   I am perfectly aware that Unicode enables enhanced
>   language support - but since my Korean is a little
>   rusty - I see that as pretty pointless.

> Point 3.
>   I am also aware that VB uses the BSTR, that ActiveX/COM
>   uses the BSTR, and that Delphi has a WideString type
>   Also that Variant Strings are implementation of the BSTR

>   That does NOT however, answer my point about
>   "what use is Unicode"
>   After all most data lands up on disk as ASCII

> I totally agree with you about preferring simplicity over complexity,
> and reckon that Unicode is an unnecessary level of complexity.

> Incidentally 'Uni' is the Sanscript word for the female {*filter*}ia - an
> apt description I think.



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
Why does it matter?  It's like {*filter*}ing about the color of the sky... can
you affect change it?  No.  We can deal with the cards that we are dealt or
go freakin' crazy ;-)

The point I was making was that given the original posters question, he was
probably fairly new to VB and possibly to programming in general.  This IS a
fairly rudimentary question you must admit.  He may not have been using the
byte array for any other reason than because it seemed cool or he had just
learned about byte arrays in a book or in school.  The fact that he
responded "Thanks, that is what I was looking for..." surprised me after
reading your posting because I *HAD* left out the strconv() call and as
someone who has used strconv() extensively for manipulation of binary data
in unicode strings (Some of the lset stuff that I showed before) I was fully
aware of the issue and had forgotten to include this.

This leads me to believe that he was trying to get the data out of a string
array and into a byte array to use the string like display behaviors of a
byte array.  Would I have done it that way... probably not.  I guess it
takes all types to make the world go around though and if he was happy, I am
happy for him.


Quote:
> On Thu, 22 Jun 2000 00:09:23 GMT, "Brian Griffin"

> Brian,

> Point 1.
>   He wanted to turn a string array into a Byte array
>   He has not explained why

> Point 2.
>   I am perfectly aware that Unicode enables enhanced
>   language support - but since my Korean is a little
>   rusty - I see that as pretty pointless.

> Point 3.
>   I am also aware that VB uses the BSTR, that ActiveX/COM
>   uses the BSTR, and that Delphi has a WideString type
>   Also that Variant Strings are implementation of the BSTR

>   That does NOT however, answer my point about
>   "what use is Unicode"
>   After all most data lands up on disk as ASCII

> I totally agree with you about preferring simplicity over complexity,
> and reckon that Unicode is an unnecessary level of complexity.

> Incidentally 'Uni' is the Sanscript word for the female {*filter*}ia - an
> apt description I think.



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
On Thu, 22 Jun 2000 19:14:23 -0700, "Michael \(michka\) Kaplan"

Quote:

>Well, J. French, you may be as provincial as you like. Those of us who work
>in the world and realize it is round see the importance of supporting other
>languages, and supporting them in a way that does not require one to have
>locale-specific changes on every single compile for each language.

So you think that the Germans are mistaken in moving to using
English/American as their business language ?

Personally I reckon that Eng/Am is the Lingua Franca of computing
(gettit) and that anyone who tries to construct a tower of Babel is
damaging the industry.

Actually most of my clients are overseas, so my 'provincial' outlook
may be based on experience.



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
Allow me to {*filter*}in. At a client site I found they had written a replace
method which converted the strings (and they are processing input text
files) to byte arrays and then searching them, skipping by 2 because of
Unicode. I pointed out the possibility of using InStr, etc. for replacement
work and they explained to me (to me!) that they had tried that, but using
the byte arrays was 20 times faster.
Given that they process thousands of files of text, I got the point.
Knowing how is an important thing. Knowing when is more important still.
--
Gary, MCT, MCP, MCSD
home site http://www.*-*-*.com/ ~garyl

Quote:
> Why does it matter?  It's like {*filter*}ing about the color of the sky... can
> you affect change it?  No.  We can deal with the cards that we are dealt
or
> go freakin' crazy ;-)

> The point I was making was that given the original posters question, he
was
> probably fairly new to VB and possibly to programming in general.  This IS
a
> fairly rudimentary question you must admit.  He may not have been using
the
> byte array for any other reason than because it seemed cool or he had just
> learned about byte arrays in a book or in school.  The fact that he
> responded "Thanks, that is what I was looking for..." surprised me after
> reading your posting because I *HAD* left out the strconv() call and as
> someone who has used strconv() extensively for manipulation of binary data
> in unicode strings (Some of the lset stuff that I showed before) I was
fully
> aware of the issue and had forgotten to include this.

> This leads me to believe that he was trying to get the data out of a
string
> array and into a byte array to use the string like display behaviors of a
> byte array.  Would I have done it that way... probably not.  I guess it
> takes all types to make the world go around though and if he was happy, I
am
> happy for him.



> > On Thu, 22 Jun 2000 00:09:23 GMT, "Brian Griffin"

> > Brian,

> > Point 1.
> >   He wanted to turn a string array into a Byte array
> >   He has not explained why

> > Point 2.
> >   I am perfectly aware that Unicode enables enhanced
> >   language support - but since my Korean is a little
> >   rusty - I see that as pretty pointless.

> > Point 3.
> >   I am also aware that VB uses the BSTR, that ActiveX/COM
> >   uses the BSTR, and that Delphi has a WideString type
> >   Also that Variant Strings are implementation of the BSTR

> >   That does NOT however, answer my point about
> >   "what use is Unicode"
> >   After all most data lands up on disk as ASCII

> > I totally agree with you about preferring simplicity over complexity,
> > and reckon that Unicode is an unnecessary level of complexity.

> > Incidentally 'Uni' is the Sanscript word for the female {*filter*}ia - an
> > apt description I think.



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array


Quote:
>Allow me to {*filter*}in. At a client site I found they had written a replace
>method which converted the strings (and they are processing input text
>files) to byte arrays and then searching them, skipping by 2 because of
>Unicode. I pointed out the possibility of using InStr, etc. for replacement
>work and they explained to me (to me!) that they had tried that, but using
>the byte arrays was 20 times faster.
>Given that they process thousands of files of text, I got the point.
>Knowing how is an important thing. Knowing when is more important still.

Unless I misunderstood your post, they must be pretty dim clients.

I mean the data is most likely ASCII /ANSII on disk so why do they not
just read the data straight into a Byte Array.

If they really need speed then they could get a DLL knocked up - but
that only speeds things up if the DLL is called infrequently with say
100k of data.
I have done this for a few people and it really speeded things up.

Maybe you should 'sell' them one of these approaches !



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
Hi Gary,

In a nutshell Mr French has his panties all in a wad because I pointed out
that he did not correctly interpret the posters ORIGINAL message.  He had
gone off on an irrelevant rant.  Of course he had to get defensive and find
something wrong with my response that *actually* proivided the original
poster with the assistance that he was looking for.  He got hung up on the
fact that I did not use strconv() to remove the high order bytes (He is
correct in this, though I am not convinced that strconv() is necessary since
as you have pointed out you can simply process every other array element).

If you read the entire thread you will note that his issue becomes "Why do
you want an array that contains the high order bytes".  My question is what
in the hell does it matter to Mr. French?  Is this his project?  His code?
His developer?  I suspect it is not.  And if it is not, why can't he walk
away?

I agree with you that copying the string into the byte array and "stepping
over" the high order bytes is probably more efficient.  After all, it is
LESS work that the processor has to do that way.

This guy is debating from a "religious" angle (Not as in christian or
muslim, more like emotional and personal) and it is a waste of breathe to
try to reason with him.  He doesn't want to learn or debate, he wants to be
RIGHT.

I guess he hasn't learned that just because someone doesn't do things the
way that he would, that doesn't make it wrong.  In my opinion the guy is
overreacting a bit and taking this a little too personal.

Bottom line: he is ticked off that the poster could not use his irrelevant
input and does not like that I called him on his lack of attention to
detail, so instead of walking away he decided to get into a pissing match
over what amounts to a difference in style.  He has not yet realized that he
is pissing into the wind and it is spraying all over his leg.

Mr. French what does any of this BS matter?  Get over it.  I'm signing off
this thread because this has simply gotten too kindergarten for my taste.
Think I'll go get me some "uni"... maybe you should too.  Takes the edge off
you know.


Quote:
> Allow me to {*filter*}in. At a client site I found they had written a replace
> method which converted the strings (and they are processing input text
> files) to byte arrays and then searching them, skipping by 2 because of
> Unicode. I pointed out the possibility of using InStr, etc. for
replacement
> work and they explained to me (to me!) that they had tried that, but using
> the byte arrays was 20 times faster.
> Given that they process thousands of files of text, I got the point.
> Knowing how is an important thing. Knowing when is more important still.
> --
> Gary, MCT, MCP, MCSD
> home site http://www.*-*-*.com/ ~garyl


> > Why does it matter?  It's like {*filter*}ing about the color of the sky...
can
> > you affect change it?  No.  We can deal with the cards that we are dealt
> or
> > go freakin' crazy ;-)

> > The point I was making was that given the original posters question, he
> was
> > probably fairly new to VB and possibly to programming in general.  This
IS
> a
> > fairly rudimentary question you must admit.  He may not have been using
> the
> > byte array for any other reason than because it seemed cool or he had
just
> > learned about byte arrays in a book or in school.  The fact that he
> > responded "Thanks, that is what I was looking for..." surprised me after
> > reading your posting because I *HAD* left out the strconv() call and as
> > someone who has used strconv() extensively for manipulation of binary
data
> > in unicode strings (Some of the lset stuff that I showed before) I was
> fully
> > aware of the issue and had forgotten to include this.

> > This leads me to believe that he was trying to get the data out of a
> string
> > array and into a byte array to use the string like display behaviors of
a
> > byte array.  Would I have done it that way... probably not.  I guess it
> > takes all types to make the world go around though and if he was happy,
I
> am
> > happy for him.



> > > On Thu, 22 Jun 2000 00:09:23 GMT, "Brian Griffin"

> > > Brian,

> > > Point 1.
> > >   He wanted to turn a string array into a Byte array
> > >   He has not explained why

> > > Point 2.
> > >   I am perfectly aware that Unicode enables enhanced
> > >   language support - but since my Korean is a little
> > >   rusty - I see that as pretty pointless.

> > > Point 3.
> > >   I am also aware that VB uses the BSTR, that ActiveX/COM
> > >   uses the BSTR, and that Delphi has a WideString type
> > >   Also that Variant Strings are implementation of the BSTR

> > >   That does NOT however, answer my point about
> > >   "what use is Unicode"
> > >   After all most data lands up on disk as ASCII

> > > I totally agree with you about preferring simplicity over complexity,
> > > and reckon that Unicode is an unnecessary level of complexity.

> > > Incidentally 'Uni' is the Sanscript word for the female {*filter*}ia - an
> > > apt description I think.



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array
Well at least *you* learnt something Brian.
Happy hunting !

On Sat, 24 Jun 2000 04:49:24 GMT, "Brian Griffin"

Quote:

>Hi Gary,

>In a nutshell Mr French has his panties all in a wad because I pointed out
>that he did not correctly interpret the posters ORIGINAL message.  He had
>gone off on an irrelevant rant.  Of course he had to get defensive and find
>something wrong with my response that *actually* proivided the original
>poster with the assistance that he was looking for.  He got hung up on the
>fact that I did not use strconv() to remove the high order bytes (He is
>correct in this, though I am not convinced that strconv() is necessary since
>as you have pointed out you can simply process every other array element).

>If you read the entire thread you will note that his issue becomes "Why do
>you want an array that contains the high order bytes".  My question is what
>in the hell does it matter to Mr. French?  Is this his project?  His code?
>His developer?  I suspect it is not.  And if it is not, why can't he walk
>away?

>I agree with you that copying the string into the byte array and "stepping
>over" the high order bytes is probably more efficient.  After all, it is
>LESS work that the processor has to do that way.

>This guy is debating from a "religious" angle (Not as in christian or
>muslim, more like emotional and personal) and it is a waste of breathe to
>try to reason with him.  He doesn't want to learn or debate, he wants to be
>RIGHT.

>I guess he hasn't learned that just because someone doesn't do things the
>way that he would, that doesn't make it wrong.  In my opinion the guy is
>overreacting a bit and taking this a little too personal.

>Bottom line: he is ticked off that the poster could not use his irrelevant
>input and does not like that I called him on his lack of attention to
>detail, so instead of walking away he decided to get into a pissing match
>over what amounts to a difference in style.  He has not yet realized that he
>is pissing into the wind and it is spraying all over his leg.

>Mr. French what does any of this BS matter?  Get over it.  I'm signing off
>this thread because this has simply gotten too kindergarten for my taste.
>Think I'll go get me some "uni"... maybe you should too.  Takes the edge off
>you know.



>> Allow me to {*filter*}in. At a client site I found they had written a replace
>> method which converted the strings (and they are processing input text
>> files) to byte arrays and then searching them, skipping by 2 because of
>> Unicode. I pointed out the possibility of using InStr, etc. for
>replacement
>> work and they explained to me (to me!) that they had tried that, but using
>> the byte arrays was 20 times faster.
>> Given that they process thousands of files of text, I got the point.
>> Knowing how is an important thing. Knowing when is more important still.
>> --
>> Gary, MCT, MCP, MCSD
>> home site http://www.*-*-*.com/ ~garyl


>> > Why does it matter?  It's like {*filter*}ing about the color of the sky...
>can
>> > you affect change it?  No.  We can deal with the cards that we are dealt
>> or
>> > go freakin' crazy ;-)

>> > The point I was making was that given the original posters question, he
>> was
>> > probably fairly new to VB and possibly to programming in general.  This
>IS
>> a
>> > fairly rudimentary question you must admit.  He may not have been using
>> the
>> > byte array for any other reason than because it seemed cool or he had
>just
>> > learned about byte arrays in a book or in school.  The fact that he
>> > responded "Thanks, that is what I was looking for..." surprised me after
>> > reading your posting because I *HAD* left out the strconv() call and as
>> > someone who has used strconv() extensively for manipulation of binary
>data
>> > in unicode strings (Some of the lset stuff that I showed before) I was
>> fully
>> > aware of the issue and had forgotten to include this.

>> > This leads me to believe that he was trying to get the data out of a
>> string
>> > array and into a byte array to use the string like display behaviors of
>a
>> > byte array.  Would I have done it that way... probably not.  I guess it
>> > takes all types to make the world go around though and if he was happy,
>I
>> am
>> > happy for him.



>> > > On Thu, 22 Jun 2000 00:09:23 GMT, "Brian Griffin"

>> > > Brian,

>> > > Point 1.
>> > >   He wanted to turn a string array into a Byte array
>> > >   He has not explained why

>> > > Point 2.
>> > >   I am perfectly aware that Unicode enables enhanced
>> > >   language support - but since my Korean is a little
>> > >   rusty - I see that as pretty pointless.

>> > > Point 3.
>> > >   I am also aware that VB uses the BSTR, that ActiveX/COM
>> > >   uses the BSTR, and that Delphi has a WideString type
>> > >   Also that Variant Strings are implementation of the BSTR

>> > >   That does NOT however, answer my point about
>> > >   "what use is Unicode"
>> > >   After all most data lands up on disk as ASCII

>> > > I totally agree with you about preferring simplicity over complexity,
>> > > and reckon that Unicode is an unnecessary level of complexity.

>> > > Incidentally 'Uni' is the Sanscript word for the female {*filter*}ia - an
>> > > apt description I think.



Wed, 18 Jun 1902 08:00:00 GMT  
 Converting string array to byte array

Quote:
>> Well at least *you* learnt something Brian. <<

By the way that would be "learned" not learnt.  I do not believe that learnt
is a proper english word.  IF you are going to be an {*filter*}bastard do it
right son!

And what have I learned from the tyrannical Mr. French?  I know 17 different
languages including VC++, Java, VB, Pascal, and Assembler and have been
prgramming for over 20 years now.  Oops.. I didn't include strconv() in my
example.  I guess it's the end of the world based on how you are carrying
on.  I have known about strconv for many years now and would point out that
it serves more purpose than to simply handle unicode strings.

Your brasheness, inflexibility,  and sub-standard interpersonal skills
clearly indicate that you are at best a junior skillset and I doubt VERY
seriously that there is much of anything that I could garner of value from
you.  But you clearly think much more of yourself (Have you noted that
no-one else seems to).

You have been demeaning or flat out insulting to three persons on this
thread alone.  This is the only reason that I decided last night to lay into
you.  You really shouldn't be surprised when you act like a first class
schmuck (Schmuck by the way is Yiddish for {*filter*}) and get some push back
from people.  You are a prime example of someone that should be banned from
this newgroup.  You are not here to help you are here to gratify your own
ego.

I suppose that I did learn that you are narrow minded, self consumed,
arrogant, egotistical control freak though.  Grow up.


Quote:
> Well at least *you* learnt something Brian.
> Happy hunting !

> On Sat, 24 Jun 2000 04:49:24 GMT, "Brian Griffin"

> >Hi Gary,

> >In a nutshell Mr French has his panties all in a wad because I pointed
out
> >that he did not correctly interpret the posters ORIGINAL message.  He had
> >gone off on an irrelevant rant.  Of course he had to get defensive and
find
> >something wrong with my response that *actually* proivided the original
> >poster with the assistance that he was looking for.  He got hung up on
the
> >fact that I did not use strconv() to remove the high order bytes (He is
> >correct in this, though I am not convinced that strconv() is necessary
since
> >as you have pointed out you can simply process every other array
element).

> >If you read the entire thread you will note that his issue becomes "Why
do
> >you want an array that contains the high order bytes".  My question is
what
> >in the hell does it matter to Mr. French?  Is this his project?  His
code?
> >His developer?  I suspect it is not.  And if it is not, why can't he walk
> >away?

> >I agree with you that copying the string into the byte array and
"stepping
> >over" the high order bytes is probably more efficient.  After all, it is
> >LESS work that the processor has to do that way.

> >This guy is debating from a "religious" angle (Not as in christian or
> >muslim, more like emotional and personal) and it is a waste of breathe to
> >try to reason with him.  He doesn't want to learn or debate, he wants to
be
> >RIGHT.

> >I guess he hasn't learned that just because someone doesn't do things the
> >way that he would, that doesn't make it wrong.  In my opinion the guy is
> >overreacting a bit and taking this a little too personal.

> >Bottom line: he is ticked off that the poster could not use his
irrelevant
> >input and does not like that I called him on his lack of attention to
> >detail, so instead of walking away he decided to get into a pissing match
> >over what amounts to a difference in style.  He has not yet realized that
he
> >is pissing into the wind and it is spraying all over his leg.

> >Mr. French what does any of this BS matter?  Get over it.  I'm signing
off
> >this thread because this has simply gotten too kindergarten for my taste.
> >Think I'll go get me some "uni"... maybe you should too.  Takes the edge
off
> >you know.



> >> Allow me to {*filter*}in. At a client site I found they had written a
replace
> >> method which converted the strings (and they are processing input text
> >> files) to byte arrays and then searching them, skipping by 2 because of
> >> Unicode. I pointed out the possibility of using InStr, etc. for
> >replacement
> >> work and they explained to me (to me!) that they had tried that, but
using
> >> the byte arrays was 20 times faster.
> >> Given that they process thousands of files of text, I got the point.
> >> Knowing how is an important thing. Knowing when is more important
still.
> >> --
> >> Gary, MCT, MCP, MCSD
> >> home site http://www.*-*-*.com/ ~garyl


> >> > Why does it matter?  It's like {*filter*}ing about the color of the sky...
> >can
> >> > you affect change it?  No.  We can deal with the cards that we are
dealt
> >> or
> >> > go freakin' crazy ;-)

> >> > The point I was making was that given the original posters question,
he
> >> was
> >> > probably fairly new to VB and possibly to programming in general.
This
> >IS
> >> a
> >> > fairly rudimentary question you must admit.  He may not have been
using
> >> the
> >> > byte array for any other reason than because it seemed cool or he had
> >just
> >> > learned about byte arrays in a book or in school.  The fact that he
> >> > responded "Thanks, that is what I was looking for..." surprised me
after
> >> > reading your posting because I *HAD* left out the strconv() call and
as
> >> > someone who has used strconv() extensively for manipulation of binary
> >data
> >> > in unicode strings (Some of the lset stuff that I showed before) I
was
> >> fully
> >> > aware of the issue and had forgotten to include this.

> >> > This leads me to believe that he was trying to get the data out of a
> >> string
> >> > array and into a byte array to use the string like display behaviors
of
> >a
> >> > byte array.  Would I have done it that way... probably not.  I guess
it
> >> > takes all types to make the world go around though and if he was
happy,
> >I
> >> am
> >> > happy for him.



> >> > > On Thu, 22 Jun 2000 00:09:23 GMT, "Brian Griffin"

> >> > > Brian,

> >> > > Point 1.
> >> > >   He wanted to turn a string array into a Byte array
> >> > >   He has not explained why

> >> > > Point 2.
> >> > >   I am perfectly aware that Unicode enables enhanced
> >> > >   language support - but since my Korean is a little
> >> > >   rusty - I see that as pretty pointless.

> >> > > Point 3.
> >> > >   I am also aware that VB uses the BSTR, that ActiveX/COM
> >> > >   uses the BSTR, and that Delphi has a WideString type
> >> > >   Also that Variant Strings are implementation of the BSTR

> >> > >   That does NOT however, answer my point about
> >> > >   "what use is Unicode"
> >> > >   After all most data lands up on disk as ASCII

> >> > > I totally agree with you about preferring simplicity over
complexity,
> >> > > and reckon that Unicode is an unnecessary level of complexity.

> >> > > Incidentally 'Uni' is the Sanscript word for the female {*filter*}ia -
an
> >> > > apt description I think.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 19 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Need to convert a 16 byte array of bytes to 4 byte integer

2. Converting from string to array of bytes

3. Convert integers and strings to byte array

4. Convert Byte Array to a String

5. Converting between String and Byte Array

6. convert Byte array to string and vice veras

7. Convert Strings to Byte arrays and back

8. Convert a string to byte array

9. Convert an array of bytes to a string

10. StrConv function - Converting a byte array to a string

11. Converting a byte array to a string

12. How to convert a byte array to string ?

 

 
Powered by phpBB® Forum Software