Skip to main content
April 25, 2023
Question

starting number is 100 & ending number is 200, I need all numbers that contains 5

  • April 25, 2023
  • 3 replies
  • 0 views

starting number is 100 & ending number is 200, I need all numbers that contains 5

    3 replies

    harshitb6843
    April 25, 2023

    a!forEach(
      items: enumerate(100)+100,
      expression: if(
        like(fv!item,"*5*"),
        fv!item,
        {}
      )
    )

    stefanhelzle0001
    April 25, 2023

    Or, without abusing that foreach ;-)

    filter(
      like(_, "*5*"),
      enumerate(100)+100
    )

    April 25, 2023

    Hi, one more way to do this....

    
    /*rule will return -1 if it does not find any number ending with 5*/
    
    a!localVariables(
      local!start:100,
      local!end: 200,
      wherecontains(
        5,
        tointeger(
          apply(
            fn!cleanwith,
            enumerate(local!end - local!start),
            5
          )
        )
      ) - 1 + local!start
    )