Skip to content

Functions

Muhammad Kevin edited this page Apr 30, 2023 · 13 revisions

in this page, i will give you information about functions in GTProxy

Utils Function

Utils Function list

strplit()

function = char** strsplit(const char* s, const char* delim, size_t* nb)

what is this for? this is for split the string

Example

char** split = strsplit("Hello World", " ", 0);
int a = 0;
while(split[a]) printf("%s ", split[a++]);
free(split) // if you are using strsplit, dont forget to free()

Output

Hello World 

CatchMessage()

function = char* CatchMessage(const char *message, ...)

What is it for? this is for format to string
so, if you want to join the string using format, and you want to return it to string, you can use CatchMessage()

Example

printf("%s\n", CatchMessage("%s%s", "Hello ", "World"));

Output

Hello World

findArray()

function = int findArray(char** array, char* val)

what is it for? this is for find the array
So, if you want to find find the array with string "blabla" (for example), and it will return integer

Example

char* split = strsplit("Hello World", " ", 0);
printf("%s\n", split[findArray(split, "World")]);
free(split) // if you are using strsplit, dont forget to free()

Output

World

arrayJoin()

function = char* arrayJoin(char** array, char* joinVal, char autoRemove)

What is it for? this is for join the array, into string
if you set autoRemove to 1, if the array is empty, the arrayJoin will not put empty array to the result

Example (autoRemove = 0)

char** split = strsplit("Hello Hi World", " ", 0);
char* result = arrayJoin(split, " ", 0);

printf("%s\n", result);

free(split);
free(result);

Output

Hello Hi World 

Example (autoRemove = 1)

char** split = strsplit("Hello Hi World", " ", 0);
split[1] = ""; // "Hi" -> empty
char* result = arrayJoin(split, " ", 1);

printf("%s\n", result);

free(split);
free(result);

Output

Hello World 

GenerateHex()

function = char* generateHex(int len)

What is it for? this is for generating hex (2 character 1 len)

Example

char* hex = generateHex(16);
printf("%s\n", hex);
free(hex);