Announcement

Collapse
No announcement yet.

validating strings

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    validating strings

    hi guys im making my login screen for my game . so far everything is going good.

    i am trying to make it so that the player must include a number within their chosen password.

    does anyone know how i can check this in unreal. i know you have a function called contains which lets you search the string to see if it contains other words, characters etc but i cant seem to find anything that would let me search the string and check if it contains a number.

    any ideas how i would go about doing this thanks

    TLDR how to check a string contains a number

    #2
    use the Contain Node inside a Loop, to check for the substrings:
    "0" - "9"
    if any of that is true, you know a number is inside the string.. if not, user needs to enter one.

    Comment


      #3
      How would I do numbers 0-9 the node only let's you put one string to check in the substring field or do you mean make 9 contain nodes and check one number in each?

      Thanks
      Attached Files
      Last edited by EniGmaa; 03-06-2017, 03:21 PM. Reason: removed picture it was massive

      Comment


        #4
        What [MENTION=452540]Chaosgod_Espér[/MENTION] suggested would, of course, work but it would require you to set up an array with 10 digits. Alternatively, you could try something like this:

        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	153.6 KB
ID:	1124398

        Comment


          #5
          Ah thanks didn't even realise there was a "is numeric" function.

          So what you're doing here is just breaking the string down into a char array and then looping through each char and checking if it is numeric .

          Thanks both of you

          Comment

          Working...
          X