Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple lines of string to multiple parameters
#2
The following methods are tested to be effective, Is there a better way?

Macro Test
Code:
Copy      Help
_s=
;using System;
;
;public class cla
;{
;,public static string Fun1(string str1)
;,{
;,,string result = str1;
;,,Console.WriteLine(result);
;,,return result;
;,}
;
;,public static string Fun2(string str1, string str2)
;,{
;,,string result = str1 + str2;
;,,Console.WriteLine(result);
;,,return result;
;,}
;
;,public static string Fun3(string str1, string str2, string str3)
;,{
;,,string result = str1 + str2 + str3;
;,,Console.WriteLine(result);
;,,return result;
;,}
;}

str arg1=
;first parameter
_s.CallCS("Fun1" arg1)

str arg2=
;second parameter
_s.CallCS("Fun2" arg1 arg2)

str arg3=
;Third parameter
_s.CallCS("Fun3" arg1 arg2 arg3)

Member function str.CallCS
Code:
Copy      Help
function~ str'_Fun [str'_Arg1] [str'_Arg2] [str'_Arg3] [str'_Arg4]

CsScript x.AddCode(this)

sel getopt(nargs)
,case 1 ret x.Call(_Fun)
,case 2 ret x.Call(_Fun _Arg1)
,case 3 ret x.Call(_Fun _Arg1 _Arg2)
,case 4 ret x.Call(_Fun _Arg1 _Arg2 _Arg3)
,case 5 ret x.Call(_Fun _Arg1 _Arg2 _Arg3 _Arg4)


Messages In This Thread
RE: multiple lines of string to multiple parameters - by Davider - 05-09-2023, 11:46 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)