Re: adob.stream - altering a byte() result

JJ <[email protected]> Tue, 3 Jun 2025 05:57:18 +0700
Newsgroups alt.comp.lang.vbscript,alt.windows7.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
On Mon, 2 Jun 2025 12:41:16 +0200, R.Wieser wrote:
> Hello all,
> 
> I've used adob.stream to get a byte() array of data.  Using midb() to read 
> every byte/character from that array works ("data(i)" doesn't :-( ).
> 
> The problem is that I can't seem to find a method to *alter* the byte() 
> string/array. using "midb(...) = ..." thows an error, and tryng to split it 
> (using leftb() and rightb() ) and glue something between the parts causes 
> the result to become a string (checked using typename).
> 
> .... and I just found out that "leftb()" itself returns a string, and not 
> just a small byte() array.
> 
> Some googeling returns a number of examples to *display* the contents of a 
> byte() array, but I can't seem to find any example altering it.
> 
> Does someone know how its supposed to be done ?
> 
> Regards,
> Rudy Wieser

mid(), left(), right(), including their "b" and "w" versions, are functions
which returns a string constant, so they can't be used as the left-side in
an assignment. No programming language allows a constant to be used as the
left-side in an assignment.

In VB/VBA/VBS, string value is not mutable like array contents. i.e. changed
in-place. It can only be changed in-place via lower level means such as
Windows API.

In VB/VBA/VBS, we can only create a new string with the modified string from
the original string, using string extraction and concatenation. Whether the
result later be assigned back to the source variable or not.