Setting Numbers in a String

Hello guys!
Just a little question on one of the newest features of HS, string!
Do you guys have any ideas on how to change digits in a string? For example, I set Hello to 124, but I want Hello to be 123, then how can I do that?

4 Likes

If it’s only numbers, just subtract one.

3 Likes

Well if you want to take 123 and turn 2 into 4, then you can’t do it. Sorry for the bad example.

2 Likes

If the string is all numbers, just do normal math operations. 123 + 20 = 143

If you are looking for a replace at index, see Petrichor’s profile.

4 Likes

Ok I will ask Petrichor. I’m making a Sudoku and I’m making a thing where if answer matches players answer, than the answer is correct.

3 Likes

Are you looking for replace at index? The project he made is pretty simple (in Hopscotch, just look at the code – it’s pretty easy to understand)

3 Likes

Can you send me link?

4 Likes

Wait I think I know lol

3 Likes
5 Likes

Yeah that one ok thanks

5 Likes