Pocket Gems interview question

How to find a sub-string in a string? How to convert a ternary expression into a binary tree structure?