How to convert a String variable into Integer?

str="15 apples"
int=method(str)

Result: int = 15

What’s the Rhino Script method, if there is one?

If you had this:

str = "15"

You could do this:

val = CInt(str)

http://msdn.microsoft.com/en-us/library/0zk841e9(v=vs.84).aspx

But because your string contains non-numeric characters, the problem gets harder. Natively, VBScript has no function to extract numbers from a string. But if you search the Internet, you can probably find numerous functions that search for numeric characters in a string using a regular expression (Regex).