Where is documentation about String Delimiters?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Where is documentation about String Delimiters?

Post by Shardik »

Shardik wrote:I didn't find the use of single quotes documented anywhere in the documentation
(perhaps I am only too dumb to find them :wink:)
TomS has finally proven that it is a fact that I am too dumb: :lol:
TomS wrote:And yes. That's documented. Asc() <- F1
But only a single char. It's documented that it can take a string.
In the PureBasic documentation for the Asc() function the use of single quotes is described:
http://www.purebasic.com/documentation/string/asc.html

Code: Select all

Syntax

    Ascii = Asc(String$)

Description

    Return the Ascii value of the first character in the string.

    Example:


      ValueASCII = Asc("!") ; 'ValueASCII' will get the value '33'


    Note: It is also possible to obtain the ASCII value of a character (and not of a chain) while placing it between apostrophes.

    Example:


      ValueASCII = '!' ; 'ValueASCII' will get the value '33'


    Note: A table with all Ascii values and their relating figures may be found here. 

Supported OS

    All
However the documentation is not correct for single quotes because it states that
only the first character of a chain can be obtained. In fact it is possible to obtain
the integer value of up to 8 characters (a quad). So this works

Code: Select all

Debug 'PureBasi'
and this doesn't work

Code: Select all

Debug 'PureBasic'
If the limit of 8 characters is exceeded the compiler even displays this helpful error message:
PureBasic compiler wrote:Numbers between '' are limited to 8 characters.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Where is documentation about String Delimiters?

Post by blueznl »

A real cynic would say: stick to the documentated behaviour.

Fortunately, I'm not a real cynic 8)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply