How do I remove the leading zeros in a string? (000010)

0 favourites
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • At this point, it's on you to learn the tool. The warning you are getting says, the pattern can match on an empty string. That means everything you can enter into it will theoretically match. It's poor design on my part but, it's not my project. I was just trying to get you something you can use quickly. Learn the tool. try to fix the warning. It will be better for you if you take the time to solve it. You will have a better understanding in the end.

    Good luck with your project.

  • Also, I just want to say, if you are allowing user input, it is better to force the user to only input valid information instead of fixing their input after. In this case, where the user types in a value, if you only want numbers, use a number input field instead of a text input field. Then, you have less to be concerned about. In Construct, there is a type property in the text input object.

  • It's not short as regex but you can use other text functions like mid

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes you are right about forcing input with number fields, then you can grab it with a string if needed. What I am working on is just in the debugger right now so there isn't a user input. What I was preparing it for has a text field. I selected a text field over a number field because there is a List object that changes what digits and non-digits are allowed. I was only wanting to know what the error meant. I wasn't sure if the site was giving a false alarm or not because I found another site that didn't give the error. I ended up using (^[0+\D]*)*(\D) for now. I checked on a few sites and it gave the proper results without the error. I couldn't have made it without you for sure. I will need to adjust it later for specific characters when I move it to another project, but I understand how to add a few search patterns now. Thanks again for the help.

    mrcgkh Thanks, I looked at it and already have something similar. Regex is efficient and I need that because the project I am going to use it in has a few loops already.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)