Behaviour of formula string\split

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • esendino
    Senior Member
    • May 2019
    • 158

    Behaviour of formula string\split

    Hi

    I was using this expression

    $array = string\split($txtfield,',');

    It split text by the comma as expected and provide as many items of the array as expected.

    If the field $txtfield has some text without any comma gives an one single item array. Perfect.

    But if $txtfield is null I would expect it provides an empty array with no item

    Instead of that I receive an array with one item. And that item is null

    Seems to me that this behaviour is not correct.
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Not sure. I'd rather throw an error. It treats null as ''. I'm ok with it.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      It's the same behavior as PHP has. It will throw error in the future.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...