Okay, got something. Here is the function to do this - haven't tested if it works for me but yes I have the tools (functions) to make it possible now..
Code:
CREATE PROCEDURE Cut (string VARCHAR(255), delimiter CHAR(1))
RETURNING VARCHAR(255);
DEFINE i INTEGER;
DEFINE loc INTEGER;
DEFINE res VARCHAR(255);
LET loc = FindStr(string, delimiter);
IF loc = 0 THEN
RETURN string;
END IF;
LET res = '';
FOR i = 1 TO loc - 1
LET res = res || string[1,1];
LET string = string[2,255];
END FOR;
RETURN res;
END PROCEDURE;
But again, I have another question linked to it. If I increase the length of the argument from 255 to anything like 10000 or something. It gives an error saying maximum length has been exceeded.
What would I do to take care of strings quite longer in size? What is the datatype that I can use? Text? The input will be a big one for me.
Text data type seems to be the one right for such big input but the thing is that I am not sure if the function FindStr would work on it? Will it? I see that we can retrieve part of the Text using start and end bytes. But to find that I need to use FindStr.
What do you suggest I must do? Best regards.