ExpressionAttributes

Function ExpressionAttributes(expression: String) : String
Returns a string formatted for use with AttributeAs<Mode> functions

This function examines a string expression such as <form attribute1="value" attribute2="value"> or <item attribute1="value" /> and extracts the attribute="value" parts, for use with the AttributeAsInteger, AttributeAsReal, AttributeAsString and AttributeAsBoolean functions.

This is very useful for combining data in one VirtualString (you could also use it to parse XML data, and use MapVirtual<Type> functions):

Example Settings:

# font.txt

$ myfont = <font name="verdana" size="12" />

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 = ExpressionAttributes(VirtualString("myfont"))
  SetFont(AttributeAsString(myexpr,"name"),AttributeAsInteger(myexpr,"size"),1)

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