You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

1

Friday, July 4th 2014, 3:50am

Calling Frink from Jabaco

Get the frink.jar from http://futureboy.us/frinkdocs/#DownloadingFrink

Put it in the classpath.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Import frink#parser#Frink


Public Sub main(ByJava args() As String)
   Dim myArgs() As String
   myArgs = args


   Dim sResult As String
   Dim interp As Frink
   
   interp = New Frink
   
   sResult = interp.parseString( "2 feet -> inches" )
   Debug().Print( sResult )
   


   sResult = interp.parseString( "2 feet -> " & Chr(34) & "inches" & Chr(34 ) )
   Debug().Print( sResult )
   

   sResult = interp.parseString( "10 feet 12 feet 8 feet -> gallons" )
   Debug().Print( sResult )

   sResult = interp.parseString( "10. feet 12 feet 8 feet water -> pounds" )
   Debug().Print( sResult )

   sResult = interp.parseString( "2. tons / (10 feet 12 feet water) -> feet" )
   Debug().Print( sResult )


   sResult = interp.parseString( "water/alcohol" )
   Debug().Print( sResult )


   sResult = interp.parseString( "2000 Calories/day -> watts" )
   Debug().Print( sResult )

End Sub




This will produce the following:

24
24 inches
552960/77 (approx. 7181.2987012987013)
59930.842153098827477
0.53394877913200465266
1.2669453946534904346
1163/12 (approx. 96.916666666666667)

Rate this thread
WoltLab Burning Board