Oxoscript turns into NanoPy - more infos

String functions

strToBool

  strToBool(str:byte[])->bool

Converts a string (byte[]) into a bool type.

strToInt

  strToInt(str:byte[])->long

Converts a string (byte[]) into an int type.

strToFloat

  strToFloat(str:byte[])->float

Converts a string (byte[]) to a float type.

strLen

  strLen(str:byte[])->int

Calculates the length of a string.

print(strLen("This is a test")) # 14

strFind

  strFind(str:byte[],search:byte[])->int

Searches for a substring (search) in a string and outputs the position where the string is located. If nothing was found, -1 is returned.

print(strFind("This is a test", "test")) # 10

strSubstring

  strSubstring(str:byte[],from:int,length:int)->byte[120]

Extracts a substring of a string from str, at the position (from) with a length (length).

Important note: Due to system limitations, the extracted string can have a maximum length of 119 characters (120-1).

print(strSubstring("This is a test",5,2)) # "is"

isEqual

  isEqual(str1:byte[], str2:byte[])->bool

Makes a lexicographical comparison. If the strings are identical, true is returned.

t1 = "test"

print isEqual(t1, "test")

strCompare

Makes a lexicographical comparison. If the strings are identical, 0 is returned. If the first string is to be classified before the second, the number is negative, otherwise it is positive.

t1 = "ABC"
t2 = "DEF"

print strCompare(t1,t2)
print strCompare(t2,t1)
print strCompare(t1, "ABC")

byteToHex

  byteToHex(value:byte)->byte[]

Converts a decimal value into hexadecimal representation.

print byteToHex(255) # FF

Example:

a = "Oxocard rocks!"
b = ""
for i in strLen(a):
    b= b + byteToHex(a[i]) #+ " "
print a + " = " + b

hexToByte

  hexToByte(value:byte[])->byte

Converts a hexadecimal number into a decimal value.

print hexToByte("FF") # 255

Example:

print "Decrypt"
source = "4F786F6361726420726F636B7321"
target = ""
for i in strLen(source)/2:
    hexValue = strSubstring(source,i*2,2)
    target[i] = hexToByte(hexValue)
print target