develooper Front page | perl.perl6.users | Postings from February 2019

Re: Fastest way to convert from a Buf to a Str?

Thread Previous | Thread Next
From:
ToddAndMargo via perl6-users
Date:
February 3, 2019 10:11
Subject:
Re: Fastest way to convert from a Buf to a Str?
Message ID:
dc07eff9-6fe7-ad1c-2c2f-366a91d0d428@zoho.com
On 2/3/19 1:55 AM, David Warring wrote:
> Are all characters in the range 0-255, ie latin-1 characters?
> 
> You could then try: my $str =  $buf.decode("latin-1");
> 
> There's one potential  issue if your data could contain DOS end of lines 
> ("\r\n"), which will get translated to a single logical "\n" in the 
> decoded string.
> 
> - David

Hi David,

It has to be an exact match.  That includes all carriage returns,
line feeds, page feeds, eofs, tabs, etc..  But thank you anyway.
:-)

-T

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About