How do I allow only digits in sting ?

0 favourites
  • 5 posts
From the Asset Store
Global plugin that allow for relatively easy and efficient implementation of an in-game inventory system
  • hi

    How do I allow only digits in sting or global object ?

  • Set the variable type to number?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • nvm i manage to do it.

    but if i change the global variable to number it will not be read by txt object.

    would have upload the capx but i cant

    dont have yet 500 rep

  • nvm i manage to do it.

    but if i change the global variable to number it will not be read by txt object.

    would have upload the capx but i cant

    dont have yet 500 rep

    if you want to show a text as number you can use i think str(valuenumber) and read it as a text or int(textglobalvariable) and read it as a number, someone corect me if im wrong. but i know one of those things turn a text into a number and viceversa. however if you have like johndoe:123 why are you adding that data in 1 variable? and not just use 2 variables 1 for text and 1 for numbers and use '&' to make them appear or use them as calculations data calls etc (ie. variabletext&variablenumber)

    [quote:14yw424w]int(x)

    Convert the float or text x to an integer (whole number). If x is text, non-numeric characters are allowed after the number, but not before. For example int("33xx") returns 33, but int("xx33") returns 0.

    [quote:14yw424w]

    str(x)

    Convert the integer or float x to a string. Generally not necessary since strings can be built using the & operator, e.g. "Your score is " & score

    manual

    you can upload a file to your google drive and post it here without https://www and without the '.' <- dotcom etc...

  • dropbox/s/u5q13yg86cewtlf/allow%20only%20digits.c3p?dl=0

    add

    w

    com

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