Characters between block no longer always returns a string

Use this template to make awesome bug reports:

Your username: Petrichor.

What kind of device are you using?: (Also include iOS version, and Hopscotch version) iPhone 8, Hopscotch 3.48.3, player 2.0.0, and also on 3.49.0 on my mac

The “characters between” block has in the past always returned a string even if the value could be converted to a number. This is a very useful feature that makes many things much easier. However, in the newest webplayer, this is no longer the case. Instead, it will convert it to a number.

The expected result is that the object would set text to “0000009b” but it removes the leading 0s since it converts to a number (and back, which is probably not very good for performance) in between the characters between block and the concatenation, which has never happened before.

Is this intentional? If it is I think that it is very important that we get a way to use strings consisting of only digits as strings very soon.

11 Likes

Yes!! This is happening to me too!

it is very important that we get a way to use strings consisting of only digits as strings very soon.

Absolutely!!

6 Likes

-1/10 would be very nice to see

6 Likes

Yeah this is not intentional — ‘characters between’ should get those characters in the string from the positions that you specified. We’ve added it to our list to fix.

3 Likes

Will this be fixed in time for the next spring competition deadline?

4 Likes

Unfortunately it probably won’t, I have added it to our list though.

1 Like

Ok it looks like Characters Between is actually converting the string to a number, or cutting off leading 0s, before slicing it.

For this code:

I expect “000” but it displays “9”

Basically whenever I change the “3” to any number higher than 1, it will keep returning 9. I suspect that the input string is converted to 9, and thus characters between 0 and any number will just keep returning 9.

Edit: now I remember the original example in the post has “a” — I’ll just edit a screenshot so the steps are clear.

4 Likes

Please fix this bug it brakes complex projects.
Also do you have a dew date?

2 Likes

Any idea when this will be fixed?

1 Like

@t1_hopscotch ^^^

we all hope as soon as possible- it’s still possible to work with string, however it’s pretty counter-intuitive and not easy to work with

personally, i think “character at index”, “character between” and “length” [1] should by default consider any number as string in their first input (just like the new update where any inputs in non-addition operators only allows numbers, not text)


  1. so basically the three text operators ↩︎

2 Likes

Yes, that too. It would also be helpful to split the + block into + and a concatenation block, instead of having it be the same block, though that one would not be as good. And of course text blocks should always return text, unless it doesn’t make sense (length)

2 Likes