-
Notifications
You must be signed in to change notification settings - Fork 619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds String Functions #6657
base: master
Are you sure you want to change the base?
Adds String Functions #6657
Conversation
TheColorRed
commented
Oct 25, 2024
•
edited
Loading
edited
I don't think their names should be derived from JavaScript functions at the cost of intuitiveness.
|
|
@Enyium I have made all the requested changes, any other feedback? |
|
Thanks a lot for the contribution! This is a solid patch, and we appreciate the effort you've put in. I'm curious about the motivation behind adding these string functions directly to Slint. Since the Slint language is meant to separate UI and logic, with the latter handled by native code, I'm wondering what use cases you have in mind that would require performing these operations within Slint itself. Some of these functions could be useful, but I’m not sure if we need the full range you've provided. A few specific points:
Overall, this is a great patch, but I’d recommend pausing further work until we’re convinced these functions are a strong fit for Slint’s goals. Please let us know if you have use case or motivation for these functions. Thanks again! |
@ogoffart The biggest reason I wanted to add this is because I wanted a Here is some pseudo code: LineEdit {
input-type: number;
text: "100%";
changed has-focus => {
if (self.has-focus) {
// Remove the % when focused
self.text = replace-all(self.text, "%", "");
}
}
accepted => {
// Add it back when the input is accepted
self.text = self.text + "%";
}
} |
Thanks for the justification. |