How to make a function return an array.

function MessagesGet(json : string): array of string; begin var m : array of string; m := json.Split('"', ':', ','); var mA: array[1..2] of string; mA[0] := m[19]; mA[1] := m[34]; //Нужно записать в массив MessagesGet mA[0] и mA[1] end; 

I have no experience with pascal.

    1 answer 1

     function MessagesGet(json: string): array of string; var m: array of string; begin m := json.Split('"', ':', ','); // это что? не знаю такого SetLength(result, 2); result[0] := m[19]; result[1] := m[34]; end; 
    • one
      "// what's this? I don't know that." This means that we have a json stork in which contains the text like "hello, I am the text and my name: Anton", well, for example. And in the split method, the parameters are transferred by which character to divide. If we say I will do this m: = json.Split (''); then only [0] - "hello," [1] - "I" [2] - "text" [3] - "and" [4] - "mine" [5] - "name:" [6] - "Anton". Very good stuff. Here is an example of what Split is in C # msdn.microsoft.com/ru-ru/library/b873y76a(v=vs.110).aspx - pavel1787mego