Ring Documentation Walkthrough #10.2 – Conversions

Welcome to the final part of this chapter.

Conversions :

  • string & number

    x = 5 see type(x) #output: NUMBER
    x = string(x)
    see type(x) #output: STRING
    x = number(x)
    see type(x) #output: NUMBER

  • ascii & char

    x = 'a'
    x = ascii(x) see x #output: 97
    x = char(x) see x #output: a

  • hex (hexadecimal)

    Convert decimal to hexadecimal

    x = '2016'
    see hex(x) #output: 7e0

  • dec

    This does the opposite of hex function

    see dec('7e0') #output: 2016

  • st2hex & hex2str (hexadecimal)

    device = 'PS4'
    device_in_hex = str2hex(device)
    see device_in_hex #output: 505334
    see hex2str('43616c6c206f662044757479') #output: Call of Duty

Congratulations!, We’ve come to the end of this chapter.

See you in the next one.


Ring Documentation Walkthrough #10.2 – Conversions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s