Hopscotch Trim Feature

A feature I’d like to see in Hopscotch is:

a trim feature

I’d use it for this type of project:

anything that requires user input—so I can trim any white space

Here are some examples of Hopscotch code that could be improved if we had this:

  • it could be possible to remove white space from user input
  • setting a variable that will be read by an object, you can keep the variables easy to read and trim white space just before its read by the clone/object

Here is an example design I’ve made:

trim(Var)

I’ve seen something similar in another programming languages, it looks like this:

I know javaScript has it, I think python may have it as well

13 Likes

to first posters I say no

7 Likes

Or you can create another string, iterate over the first string and copy all characters to the second string that aren’t whitespaces.
(Python does have it)

5 Likes

Is this not just a more limited version of replace?

4 Likes

how would you remove white space with replace?

4 Likes
"Testing testing".replace(/\s/g,"")

"Testingtesting"

"Testing   testing           testing".replace(/\s+/g," ")

"Testing testing testing"

@Nobody

5 Likes

ah, makes sense

3 Likes

Hmm makes sense
Wouldn’t be used a lot tho

2 Likes

Omg omg lol. I need this for save codes! You can trim any text right? Like _ or numbers? I need this

2 Likes

just white space

2 Likes