PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Extracting strings
  • UNICODE and ANSI
  • Operating mode in GO mode and at run time
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Returns the ASCII code of specified character. The ASCII code used corresponds to the ANSI standard of Windows.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
ASCIICode = Asc("A")    // Returns 65
ASCIICode = Asc("Barbier")   // Returns 66
Syntax
<Result> = Asc(<Character String to Process>)
<Result>: Integer
Requested ASCII code (between 0 and 255).
Windows Mobile This code is included between 0 and 65535.
<Character String to Process>: Character, character string or buffer
Character whose ASCII code must be calculated. If this parameter corresponds to:
  • an empty string or an empty buffer, <Result> will be equal to 0.
  • a character string, <Result> will be equal to the ASCII code of the first character.
  • a buffer, <Result> will be equal to the ASCII code of the first byte.
Remarks

Extracting strings

Extracting a string (via the [[ and ]] operators) can be used to convert a character found anywhere in a string.
For example: "Asc(Str[[N]])" returns the ASCII value of Nth character found in the "Str" string.
Windows Mobile

UNICODE and ANSI

About 30 specific characters have a different ASCII code according to their format (UNICODE or ANSI).
Asc returns the ASCII code of a character in UNICODE format.
To find out the ASCII code of a character in UNICODE format, this character must be converted into ANSI (UnicodeToAnsi) before calling Asc.
For example:
Charact1 = Charact(128)     // Returns "€"
Charact2 = Charact(8364)      // Returns "€"
Code1 = Asc("€")            // Returns 8364
Code2 = Asc(UnicodeToAnsi("€"))     // Returns 128
Windows Mobile

Operating mode in GO mode and at run time

In GO mode (simulation on the development computer), when ASC is called, the ASCII code returned corresponds to the ASCII code of the character in ANSI format.
For example, running the following code:
Code1 = Asc("€")
  • in GO mode, this code returns 128.
  • at run time, this code returns 8364.
The differences between GO mode (simulator) and real use are presented in Differences between GO mode and real use.
Component : wd240vm.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
EXAMPLE WxUnCryptASCII
WxUnCryptASCII(SenhaCryptografada is string)

Senha is string = HexaToAscii(SenhaCryptografada)

Senha = ExtractString(Senha,3,";",FromBeginning)

RESULT Senha
BOLLER
17 Apr. 2019
EXAMPLE WxCryptASCII
WxCryptASCII(Login is string, Senha is string, DataCadastro is int)

Login = Lower(Login)

Senha = Lower(Senha)

Resultado is Variant = Login +";"+ Senha +";"+ DataCadastro +";BOB-ESPONJA-BOLLERZITO"

Hash01 is Buffer = HashString(HA_MD5_128, Resultado)

Resultado = Hash01 + ";" + Resultado +";"+ Hash01

Resultado = AsciiToHexa(Resultado)

RESULT Resultado
BOLLER
17 Apr. 2019
EXAMPLE AsciiToIntegerString - Ascii To Integer String
PROCEDURE AsciiToIntegerString(sCh is string)

sIntegerString is string
nStringSize is int = Length(sCh)
sStringToProcess is string

FOR i = 1 TO nStringSize
sStringToProcess = Middle(sCh,i,1)
sIntegerString += [TAB] + Asc(sStringToProcess)
END

RESULT sIntegerString
BOLLER
17 Apr. 2019
EXAMPLE HexaToAscii - Hexa To Ascii
PROCEDURE HexaToAscii(sCh is string)

sHexaString is string = Upper(sCh)

sAsciiString is string
sIntegerString is string
nSize is int = IntegerPart((Length(sHexaString)/2))
sStringToProcess is string
s is string
j is int = 1

FOR i = 1 TO nSize
sStringToProcess = Middle(sHexaString,j,2)
j = j+2
sIntegerString += [TAB] + NumToString(HexaToInt(sStringToProcess))
END

FOR EACH STRING s OF sIntegerString SEPAREE BY TAB
sAsciiString += Charact(Val(s))
END

RESULT sAsciiString
BOLLER
17 Apr. 2019
EXAMPLE AsciiToHexa - Ascii To Hexa
PROCEDURE AsciiToHexa(str is string)

sHexaString is string
FOR nChar=1 _TO_ Length(str)
sHexaString += NumToString(Asc(str[[nChar]]),"02x")
END

RESULT sHexaString
BOLLER
17 Apr. 2019