How do I parse strings?

  • Hi guys,

    I googled for a while, and read the expressions documentation, but I cant find the way how to parse strings.

    I want to take string data (number) entered in text box from it and use as a value for global variable. So I can write number in the texbox while runnig the app and use that value in some calculations.

    How can I do that? Thx in advance.

  • Hi,

    I'm confused, I need more info. Are you expecting different numbers in your textbox input and therefore trying to separate (parse) them into individual number data? Or are you trying to use a number typed into a textbox as a global value. If it is the latter I would do this:

    TextBox: On text changed > System: set "GlobalVariable" to int(trim(TextBox.text))

    int() changes a string into an interger and trim() makes sure you didn't accidentally hit the space bar. You can also change to condition to when button clicked if you want to wait for the full number to be typed in.

    If this has not answered your question, please give an example of what you are trying to do.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes that is what I was looking for. I did not know how to ask the question.

    Solution worked perfectly, thank you

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