How do I match a string in an array with variable?

From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Array For each X element

    --> System Array.CurValue = globalvariable1

    The global variable is always lowercase with no non-alphanumeric or spaces.

    The array contains capitalized words with non-alphanumeric.

    Example:

    Array.CurValue could be Hello.

    globalvariable could be hello

    It does not recognize a match because of the uppercase and period. I originally had lowercase(Array.CurValue) but then this does not resolve the "."

    Then I tried find(aTexttoArray.CurValue, "[^a-z]"). Also did not work. I tried variations with the Regex expressions but could not get the right code. Any help would be appreciated. Thanks!

  • You can remove the period and convert to lowercase:

    lowercase(replace(Array.CurValue, ".", ""))

    If there are many such characters that you need to remove, it may be easier to use a local variable:

    set t to replace(Array.CurValue, ".", "")
    set t to replace(t, ",", "")
    set t to replace(t, ":", "")
    set t to replace(t, "!", "")
    set t to replace(t, "?", "")
    set t to lowercase(trim(t))
    

    Or use regexreplace()

  • You could use Find with a Global Variable(String)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you!!

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