ExpressionParameters

Function ExpressionParameters(expression: String, [prefixComma: Boolean = TRUE]) : String
Returns a string formatted for use with ParameterAs<Mode> functions

This function examines a string expression such as "myfunc(param1, param2)" and extracts bits between the brackets - the "param1, param2", for use with the ParameterAsInteger, ParameterAsReal, ParameterAsString and ParameterAsBoolean functions.

This is very useful for combining data in one VirtualString:

Example Settings:

# font.txt

$ font = (arial, 12, CONST_FNT_BOLD)

Example Program:

Program
  Uses
basilisk, pure2d

Var
   myexpr : String   
Begin
  InitBasilisk(TRUE)
  ReadSettings("font.txt")

   OpenScreen(640,480,32,FALSE,COB_SHOWCLOSE+COB_SHOWBORDER)

  myexpr = ExpressionParameters(VirtualString("myfont"))
  SetFont(ParameterAsString(myexpr,1),ParameterAsString(myexpr,2),ParameterAsString(myexpr,3))

   Text(10,10,"I like waffles!")
  
  While Not ExitRequested
   Flip
   Pause
(2)
  Wend
     
End

To make extraction easier, the function prefixes a comma to the expression. If you are using this function with no intent of using the ParameterAs<Mode> functions, then you may want to supply FALSE to the prefixComma parameter.