When you search in Google "100F to C" how does it know to convert from Fahrenheit to Celsius? Similarly, conversion from different currencies and simple calculation.
What is the data structure used, or is it simple pattern matching the strings?
It's not exactly simple pattern matching. Evaluating the mathematical expressions you can enter is not trivial. For example, here's an algorithm that evaluates a math expression. That's just the evaluation, there's probably a lot of code to detect if it's even valid.
For the currencies conversion and other units, that's simple pattern matching.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With