Page 2 of 2

Re: Where is documentation about String Delimiters?

Posted: Wed Nov 03, 2010 12:17 pm
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.

Re: Where is documentation about String Delimiters?

Posted: Thu Nov 04, 2010 11:04 am
by blueznl
A real cynic would say: stick to the documentated behaviour.

Fortunately, I'm not a real cynic 8)