PeekS with Flag #PB_ByteLength

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

PeekS with Flag #PB_ByteLength

Post by Josh »

Help wrote:#PB_ByteLength:
only valid when using the #PB_UTF8 flag, the 'Length' will represent bytes (not characters).
Would be nice, if this could be changed, that the Flag #PB_ByteLength is simply ignored, if the format is not Utf8.

Background: Copying file-text to memory an then using PeekS, I can use the BOM as flag. At the moment I have to make an additional check to see if I can use #PB_ByteLength or not.
sorry for my bad english
User avatar
mk-soft
Always Here
Always Here
Posts: 5389
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PeekS with Flag #PB_ByteLength

Post by mk-soft »

Is not Unicode you can use PeekS with type #PB_Ascii...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: PeekS with Flag #PB_ByteLength

Post by kenmo »

Why request that #PB_ByteLength is ignored for ASCII and Unicode?

Better, let's request that #PB_ByteLength is implemented for ASCII and Unicode.

Should be simple...
numAsciiChars = numAsciiBytes
numUnicodeChars = numUnicodeBytes/2 (by PB's definition of characters)
Post Reply