Translate StrExtract() function into DLL not working?

Hi everyone!
I try to translate StringExtract() function into DLL with syntax as bellow:

static char *StrExtract(char *text, int field, char *separator = ",")
	AmiVar arg[3];
	arg[0].type = VAR_STRING;	arg[0].string = text;
	arg[1].type = VAR_FLOAT;	arg[1].val = field;
	arg[2].type = VAR_STRING;	arg[2].string = separator;
	AmiVar result = gSite.CallFunction("StrExtract", 3, arg);
	return result.string;

I don't know why StringExtract() woking not correct?

@diamond, maybe you should modify the 3rd parameter type, as discussed in this previous thread.

1 Like

Third parameter is NOT string. It is a number, representing ASCII code.

But what is more important, you should NOT be writing plugins in first place

Plugins are NOT for merely calling AFL functions. That should be left in AFL formula.

1 Like

The thread is a duplicate of: Using Separator Parameter in StrExtract Function - Getting Error that it's expecting a number