Revision history for KeyPgAsc


Revision [25844]

Last edited on 2022-01-30 01:03:57 by fxm [formatting]
Additions:
::c::
Deletions:
::c::


Revision [25843]

Edited on 2022-01-28 23:46:02 by fxm [formatting]
Additions:
Returns the corresponding ASCII or Unicode integer representation of a character.
Deletions:
Returns the corresponding ASCII or Unicode integer representation of a character


Revision [25842]

Edited on 2022-01-28 04:33:41 by fxm [formatting]
Additions:
<<##the Unicode of the second char of Привет, мир is: 1088##<<
Deletions:
<<##the Unicode of the second char of Привет, мир is: 1088
##<<


Revision [25841]

Edited on 2022-01-28 04:20:57 by fxm [formatting]
Additions:
{{fbdoc item="filename" value="examples/manual/strings/asc.bas"}}%%(freebasic)
will produce the output:
%%the ascii code of 'a' is: 97
Unicode example (Note to documentation editors: don't put inside ""%%(qbasic)"" markers or the Russian text will disappear!)
<<##dim a as wstring * 12
a = "Привет, мир"
print "the Unicode of the second char of " & a & " is: " & asc(a, 2)##<<
::c::will produce the output:
<<##the Unicode of the second char of Привет, мир is: 1088
##<<
::c::
Deletions:
{{fbdoc item="filename" value="examples/manual/strings/asc.bas"}}%%(freebasic)
will produce the output:
%%the ascii code of 'a' is: 97
Unicode example (Note to documentation editors: don't put inside ""%%(qbasic)"" markers or the Russian text will disappear!)
<<##dim a as wstring * 12
a = "Привет, мир"
print "the Unicode of the second char of " & a & " is: " & asc(a, 2)
##<<::c:: will produce the output:
<<##the Unicode of the second char of Привет, мир is: 1088
##<<::c::


Revision [22544]

Edited on 2019-01-07 06:14:05 by fxm [Added a sentence when all arguments are evaluable at compile time]
Additions:
If both ##//str//## and ##//position//## can be evaluated at compile time (like ##**Asc**("a")## or ##**Asc**(chr(97))## or ##**Asc**("abc", 2)## ...), the value is returned in a ##[[KeyPgUinteger|uinteger]]## result, otherwise in a ##[[KeyPgUlong|ulong]]## result.
Deletions:
If both ##//str//## and ##//position//## can be evaluated at compile time (like ##Asc("a")## or ##Asc(chr(97))## or ##Asc("abc", 2)## ...), the value is returned in a ##[[KeyPgUinteger|uinteger]]## result, otherwise in a ##[[KeyPgUlong|ulong]]## result.


Revision [22543]

Edited on 2019-01-07 02:08:07 by fxm [Added a sentence when all arguments are evaluable at compile time]
Additions:
If both ##//str//## and ##//position//## can be evaluated at compile time (like ##Asc("a")## or ##Asc(chr(97))## or ##Asc("abc", 2)## ...), the value is returned in a ##[[KeyPgUinteger|uinteger]]## result, otherwise in a ##[[KeyPgUlong|ulong]]## result.


Revision [21995]

Edited on 2017-11-21 01:10:45 by JeffMarshall [fix page link name case]
Additions:
If ##//str//## is a ##[[KeyPgWstring|WString]]##, the ##[[KeyPgUshort|UShort]]## (Windows) or ##[[KeyPgUlong|ULong]]## (Linux) value at that ##//position//## is returned. This will be a 16bit value on Windows (WStrings use UTF16 there), or a 32bit value on Linux (WStrings use UTF32 there).
Deletions:
If ##//str//## is a ##[[KeyPgWstring|WString]]##, the ##[[KeyPgUshort|UShort]]## (Windows) or ##[[KeyPgULong|ULong]]## (Linux) value at that ##//position//## is returned. This will be a 16bit value on Windows (WStrings use UTF16 there), or a 32bit value on Linux (WStrings use UTF32 there).


Revision [21512]

Edited on 2016-07-22 14:30:11 by DkLwikki [Fix Unicode example]
Additions:
<<##dim a as wstring * 12
print "the Unicode of the second char of " & a & " is: " & asc(a, 2)
Deletions:
<<##dim a as wstring * 11
print "the Unicode of the second char of " & a & " is: " & asc(a)


Revision [20051]

Edited on 2016-02-10 15:54:36 by DkLwikki [Update link format]
Additions:
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Asc** ( [[KeyPgByref|byref]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgString|string]], [[KeyPgByval|byval]] //position// [[KeyPgAs|as]] [[KeyPgInteger|integer]] = 1 ) [[KeyPgAs|as]] [[KeyPgUlong|ulong]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Asc** ( [[KeyPgByval|byval]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgZstring|zstring]] [[KeyPgPtr|ptr]], [[KeyPgByval|byval]] //position// [[KeyPgAs|as]] [[KeyPgInteger|integer]] = 1 ) [[KeyPgAs|as]] [[KeyPgUlong|ulong]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Asc** ( [[KeyPgByval|byval]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgWstring|wstring]] [[KeyPgPtr|ptr]], [[KeyPgByval|byval]] //position// [[KeyPgAs|as]] [[KeyPgInteger|integer]] = 1 ) [[KeyPgAs|as]] [[KeyPgUlong|ulong]]
If ##//str//## is a ##[[KeyPgString|String]]## or a ##[[KeyPgZstring|ZString]]##, the ##[[KeyPgUbyte|UByte]]## value at that ##//position//## is returned. This will be a 7-bit [[CptAscii|ASCII]] code, or even a 8-bit character value from some code-page, depending on the string data stored in ##//str//##.
If ##//str//## is a ##[[KeyPgWstring|WString]]##, the ##[[KeyPgUshort|UShort]]## (Windows) or ##[[KeyPgULong|ULong]]## (Linux) value at that ##//position//## is returned. This will be a 16bit value on Windows (WStrings use UTF16 there), or a 32bit value on Linux (WStrings use UTF32 there).
##[[KeyPgChr|Chr]]## performs the opposite function for ASCII strings, while ##[[KeyPgWchr|WChr]]## is the opposite for Unicode strings, returning a string containing the character represented by the code passed as an argument.
- [[CptAscii|ASCII Character Codes]]
- ##[[KeyPgChr|Chr]]##
- ##[[KeyPgStr|Str]]##
- ##[[KeyPgVal|Val]]##
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUlong ulong]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgZstring zstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUlong ulong]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgWstring wstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUlong ulong]]
If ##//str//## is a ##[[KeyPgString String]]## or a ##[[KeyPgZstring ZString]]##, the ##[[KeyPgUbyte UByte]]## value at that ##//position//## is returned. This will be a 7-bit [[CptAscii ASCII]] code, or even a 8-bit character value from some code-page, depending on the string data stored in ##//str//##.
If ##//str//## is a ##[[KeyPgWstring WString]]##, the ##[[KeyPgUshort UShort]]## (Windows) or ##[[KeyPgULong ULong]]## (Linux) value at that ##//position//## is returned. This will be a 16bit value on Windows (WStrings use UTF16 there), or a 32bit value on Linux (WStrings use UTF32 there).
##[[KeyPgChr Chr]]## performs the opposite function for ASCII strings, while ##[[KeyPgWchr WChr]]## is the opposite for Unicode strings, returning a string containing the character represented by the code passed as an argument.
- [[CptAscii ASCII Character Codes]]
- ##[[KeyPgChr Chr]]##
- ##[[KeyPgStr Str]]##
- ##[[KeyPgVal Val]]##


Revision [17851]

Edited on 2015-12-16 11:28:55 by DkLwikki [Fix result type & improve description]
Additions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUlong ulong]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgZstring zstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUlong ulong]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgWstring wstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUlong ulong]]
The raw character value stored at ##//position//## in ##//str//##.
If ##//str//## is a ##[[KeyPgString String]]## or a ##[[KeyPgZstring ZString]]##, the ##[[KeyPgUbyte UByte]]## value at that ##//position//## is returned. This will be a 7-bit [[CptAscii ASCII]] code, or even a 8-bit character value from some code-page, depending on the string data stored in ##//str//##.
If ##//str//## is a ##[[KeyPgWstring WString]]##, the ##[[KeyPgUshort UShort]]## (Windows) or ##[[KeyPgULong ULong]]## (Linux) value at that ##//position//## is returned. This will be a 16bit value on Windows (WStrings use UTF16 there), or a 32bit value on Linux (WStrings use UTF32 there).
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgZstring zstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgWstring wstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
The ASCII or Unicode integer representation of the character at ##//position//## in ##//str//##.
If ##//str//## is a ##[[KeyPgString String]]## or a ##[[KeyPgZstring ZString]]##, an [[CptAscii ASCII]] code value is returned.
If ##//str//## is a ##[[KeyPgWstring WString]]##, a [[CptAscii Unicode]] code value is returned.


Revision [17667]

Edited on 2015-06-12 05:49:13 by FxMwikki [Suppressed the no-relevant keyword 'Overload' in Syntax]
Additions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** [[KeyPgOverload overload]] ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]


Revision [15527]

Edited on 2011-12-04 22:32:35 by CountingPine [Minor formatting (monospace 0/1)]
Additions:
The function returns zero (##0##) if the string is a zero length string, ##//position//## is less than one (##1##), or ##//position//## is greater than the number of characters in ##//str//##.
Deletions:
The function returns zero (0) if the string is a zero length string, ##//position//## is less than one (1), or ##//position//## is greater than the number of characters in ##//str//##.


Revision [14259]

Edited on 2009-08-29 21:51:08 by CountingPine [Remove CamelCase links in "New to FreeBASIC"]
Additions:
- The optional ##//position//## argument is new to ""FreeBASIC"".
Deletions:
- The optional ##//position//## argument is new to FreeBASIC.


Revision [13937]

Edited on 2008-11-30 07:37:21 by JeffMarshall [name case fixup]
Additions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** [[KeyPgOverload overload]] ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgZstring zstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstQualifier const]] [[KeyPgWstring wstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** [[KeyPgOverload overload]] ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstqualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstqualifier const]] [[KeyPgZstring zstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstqualifier const]] [[KeyPgWstring wstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]


Revision [13901]

Edited on 2008-11-28 18:49:09 by LaananFisher [Fixed: const-correctness]
Additions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** [[KeyPgOverload overload]] ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgConstqualifier const]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstqualifier const]] [[KeyPgZstring zstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgConstqualifier const]] [[KeyPgWstring wstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
Deletions:
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** [[KeyPgOverload overload]] ( [[KeyPgByref byref]] //str// [[KeyPgAs as]] [[KeyPgString string]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgZstring zstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Asc** ( [[KeyPgByval byval]] //str// [[KeyPgAs as]] [[KeyPgWstring wstring]] [[KeyPgPtr ptr]], [[KeyPgByval byval]] //position// [[KeyPgAs as]] [[KeyPgInteger integer]] = 1 ) [[KeyPgAs as]] [[KeyPgUinteger uinteger]]


Revision [11447]

The oldest known version of this page was created on 2007-11-09 16:00:34 by JeffMarshall [Fixed: const-correctness]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode