passing variable # of Formal Parameters

 

Is there some way to create a function that will allow me to pass an unknown # of Formal Parameters like StringConcatenate()?

Specifically I get tired of typing "StringConcatenate" with 2 spaces in between each parameter. I would like to write a function "SC()" that automatically puts 2 spaces in between each parameter passed to it then calls StringConcatenate. The best I've can think of is:

string SC(string s1="",string s2="",string s3="".... string s18="")
   {
      return(StringRightTrim(StringConcatenate(s1,"  ",s2,"  ",s3.....s18)));
   }

Preferably I would like to just have the possibility of passing more than 18 parameters without having to add parameters to the function.

 
FoxGuy:

Is there some way to create a function that will allow me to pass an unknown # of Formal Parameters like StringConcatenate()?


The number of parameters that can be passed with StringConcatenate is not unknown, it is limited to 64. I do get your point though and I think your solution is probably a good one . . just add as many parameters as you are likely to need . . .
 
RaptorUK:
The number of parameters that can be passed with StringConcatenate is not unknown, it is limited to 64. I do get your point though and I think your solution is probably a good one . . just add as many parameters as you are likely to need . . .

This isn't the only utility function I have written. I expect to write more as I learn MT4. I have several hundred in my toolbox for spreadsheets and databases, so I expect that I will have a lot in MT4.

I was really hoping there was some way to simplify the parameters list.

Oh Well;