Forum Discussion
How List.PositionOF works
Anonymous Yes, my point is since no ascii code is assigned to "", why Text.PositionOf returns positions of "" in "aba", whereas "aba" doesn't split at those positions?
Nowhere to find an explanation to the mechanism to parse "" by PQ. 🤔
Hi CNENFRNL ,
I came up with this idea, to give a possible explanation to your interesting observation:
"" is obviously not a character but it is a text (empty but text, while the "empty" character does not exist).
If "" could be used as a character it would become a sort of wildcard like the "?".
In fact, if you use the function:
Text.EndsWith ("abc", "c")
gives TRUE
and the same happens with
Text.EndsWith ("abc", "") -> TRUE.
From this we could derive that "c" = "" 🙂 and if it holds for c, it holds for any other character.
- Icey5 years agoCommunity Support
Hi Anonymous ,
Why can't we think of it this way: “abc” ends with "" when in " Text.EndsWith("abc", "") " and "abc" ends with "c" when in " Text.EndsWith("abc", "c") "?
There can be a "" behind "c" in "abc", right?🤔
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous5 years agoNot applicable
<<If "" could be used as a character it would become a sort of wildcard like the "?".>>
What was written was to prove that "" is a string and not a single character, because if it were(*) there would be the contradictory result that "" is equal to any character.
However, apart from these dialectical joke, what I wanted to point out is that theText.PositionOf ("abc", ...)
finds only 3 empty substrings and not 4 as I would have expected (also for symmetry),
If you use Text.PositionOf (text.reverse ("abc"), ...) you get the same result)PS
I observed this, in my opinion strange, behavior while trying to find a custom function for the VLOOKUP
(*)
if "" is considered, as it actually should, as a string instead there is no contradiction as there is not in these cases:
Text.EndsWith("abc","c")=true
Text.EndsWith("abc","bc")=true
from which the only logical consequence that can be drawn is that one of the two strings is a substring of the other, but not that they are equal