Home > Net >  Why does strpos, position, charindex return 1 when empty substring is passed
Why does strpos, position, charindex return 1 when empty substring is passed

Time:09-28

Why do all three of these return a value of 1 in redshift?

select strpos('X', '')
select position('' in 'X')
select charindex('', 'X')

CodePudding user response:

Because the empty string is the very first part of all strings.

  • Related