Closed fflorent closed 3 months ago
I usually do this with regex:
page where name =~ /^notes\/Meeting\ notes\//
but having startsWith would be more intuitive
What I haven't really decided on is how far I want to extend the range of builtin functions now that it's possible to do this in "user land" using https://silverbullet.md/Space%20Script
I think my preference would be to develop a string manipulation library that you can import and then use rather than have a ever growing list of builtin functions PHP-style. The introduction of contains
was already questionable in that sense. And in this case, indeed a regex will also do.
Right! Closing in favor of this alternative.
I would find very useful to propose a
startsWith(str, substr)
function to, let's say, filter pages whose are contained in a certain folder.Also I could imagine that in some cases
endsWith(str, substr)
could also benefit to some users, even if I don't have concrete use cases (I can understand that it will be decided to not implement it until then).It would be a continuation of this work which introduced
contains
: https://github.com/silverbulletmd/silverbullet/commit/42dd7f36784f8edd7a1bd099d753413d4116a449What do you think? I would be glad to propose a patch if you agree with that proposal.