Last character of the textbox is a .(dot) and if yes, replace empty else nothing

  • I want to show, Check if the last Character of textbox is a .(dot) then that last character consider as empty. else nothing to change.
  • if textbox.text = 01234. then result will be =01234
    else if textbox.text = 01234.0 then result will be =01234.0

blocks (1)
blocks (3)

I have tried my best but I am not getting the answer please help.
Thank you

Don’t you want just the (.) dot killed and not a space ( ) instead? Just bc it’s more logic. :thinking:

If no, I am working on your space-replacement-method…

1 Like

You set the variable dot to empty string, thats why you got nothing.

1 Like

Yes, but he is also just returning the emptystring and not the whole text + the string. This is his mistake.

1 Like

I have a test currently (yes I took my time out so I could answer this)
Here ya go, it’s completely untested btw so do let me know if there are any bugs
blocks (41)

1 Like

Thats exactly what I want to say lol

I use a clock component for calculation. When the textbox.text is changed it is calculated. The problem is contains a .dot in the text box, which shows the NaN error. Once the decimal place is filled it will work properly.

Pls try what ontstudio give you

Also, an alternative method (but more complicated)

Change the Text_Box1.Text to want you want, or make a input

Thank you so much for your solution. But this is not dealing with my problem.

can u explain why?

Wait what? Why i am the solution

Working well Thank you so much. :heart_eyes:

blocks (4)

1 Like

Oh i tried ontstudio solution but there’s an error
And I know the error
I used ontstudio idea, and make some modification and it worked
In the “if” part, the segment length cannot be length of text. Instead it should be 1
In the “then” part segment start should be 1


Yeah, I got it. The start should be 1, not length. Silly me. Sorry, I was nervous because the clock on the test was ticking, and I was out here answering questions on the community.


My thanks to everyone.

This is shows false. not working for me.

There’s no way it will

And it worked for me
btw this is the better solution.

1 Like

I tested many times, this is the best solution. Thank you very much. :smiley:


what about using the On Text Changed event of the textbox for this?


I will do it. Thanks for your suggestion.

1 Like