Re: [q-lang-users] Two proposed improvements to Q
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2008-01-22 12:53:32
|
Albert Graef wrote: > I just need to add a function to replace a slice of a byte > string in-place. Ok, this is in cvs now. Examples: ==> put_uint32 B (-2) (uint32_vect [90..94]) () ==> uint32_list B [92,93,94,103,104,105,106,107,108,109,110] ==> uint32_list $ get_uint32 B (-2,3) [92,93,94,103] ==> uint32_list $ get_uint32 B (8,100) [108,109,110] Note that these operations are all safe in that indices are automatically confined to stay within the bounds of the target vector. Here's how you can manipulate a string represented as a byte string in a given character encoding: ==> def S = bytestr ("Hello world!","latin1") ==> put_uint8 S 3 $ bytestr ("äöü","latin1"); bstr S () "Heläöüworld!" Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |