ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / String functions
  • Extracting strings
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns the ASCII code of the specified character. The ASCII code used corresponds to the ANSI standard used in Windows.
ASCIICode = Asc("A")    // Returns 65
ASCIICode = Asc("Barbier")   // Returns 66
Syntax
<Result> = Asc(<Character string to process>)
<Result>: Integer
ASCII code (between 0 and 255).
<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 buffer, <Result> will be 0.
  • a character string, <Result> will be the ASCII code of the first character.
  • a buffer, <Result> will be the ASCII code of the first byte.
WEBDEV - Browser code In this version, this parameter can only correspond to a character or to a character string.
Remarks

Extracting strings

You can extract a string with the [[ and ]] operators to convert a character at any position in the string.
For example: "Asc(Str[[N]])" returns the ASCII value of the Nth character in the "Str" string.
Component: wd290vm.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 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 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 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

Last update: 03/04/2024

Send a report | Local help