On 6/9/22 22:54, ToddAndMargo via perl6-users wrote: > Hi All, > > I can easily get away with this in Modula2, but > how can I do this with Raku? > > I wish to create a single variable that can be > manipulated in two ways: > > 1) as a fixed length string (Str) > > 2) as a fixed length buffer (Buf) > > I can think of ways to do this, but it would > require separate variable and conversions routines > back and forth. > > Any words of Raku wisdom? > > Many thanks, > -T > Hi All, I do believe what I am asking is not possible in Raku. In Modula2, it is ridiculously easy to do. But there is a fly in the ointment. There is a possibility of chr(0)'s in the resultant string. And in Modula2, as is in C, that is a string terminator. So Raku is a much better choice, as the length of a string is kept in a hidden structure and not in the the string itself. And I am done with Modula2 and use Raku for a reason. Anyway, I have been wrapping my mind around how to do this in Raku. With some chr's and ord's, I can accomplish what I need. And some string tricks I learned in Perl 5. When I come up working module for this, I will get back. I think you all will find it very useful. Ya, I know I am being a bit cryptic, but all will be revealed. Eventually. :-) -TThread Previous | Thread Next