Skip to main content
Question

Delete last character in string variables


I am really excited to use the string variables that have been recently added to Figma. I want to implement a string variable and to delete the last character of the string every time the delete key is pressed.

I’m not finding much documentation on the string variables yet, but I know that it’s new. Has anyone figured out how to delete the last character of a string variable in a prototype?

This topic has been closed for comments

Avokadomos

You can’t remove characters from strings afaik, so you’ll have to fake it. You could make each letter its own layer, and toggle it’s visibility based on a number variable that decreases on every key press.


Sndel_King

I had a similar situation and had an idea on how to handle it: You can store the result from the previous iteration in a separate variable before adding characters each time with set variable. For example, before doing set variable: [name] = [name] + “a”, you could do set variable: [name - previous input] = [name] to save the value beforehand. That way, when you need to remove something, you can execute: set variable: [name] = [name - previous input] to revert it back to the previous value.


create a temporary variable to hold the previous string before the character insertion. It will work only for 1 character though


DameGeri
  • New Participant
  • March 28, 2024

Has anyone managed to get this to work? I’ve not been successful in implementing the idea. Thanks


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings