nicklockwood / Expression

A cross-platform Swift library for evaluating mathematical expressions at runtime
MIT License
829 stars 51 forks source link

uppercased expression #7

Closed sergeymild closed 6 years ago

sergeymild commented 7 years ago

What about expression like: text="{uppercased('hello')}"?

nicklockwood commented 7 years ago

This should work fine, but I'm guessing based on the syntax in your example that you're asking in the context of using it with Layout?

Expression doesn't have any built-in support for strings, that's provided by the AnyExpression class in Layout.

Layout doesn't currently provide any public API for adding your own functions, so you'd have to modify the library to add an uppercased() method.

sergeymild commented 7 years ago

I tried add, but AnyExpression not exactly isn't correct name, because it only support Number types. And i don't see places where i can add this feature. Maybe can you give me a hint where to look? Yes, i want use in Layout this feature. i.e. i want some method expression to make some strings uppercased.

nicklockwood commented 6 years ago

@sergeymild custom functions are now supported in Layout version 0.6.17. See here for details: https://github.com/schibsted/layout/blob/master/README.md#functions