# How to count the number of characters seperated by a special character in a string?

I have a string in which a special character is treated as the separator. For example, str={aA|B|b|Ca|XYzz}, where "|" is the separator. Then I want to count the numbers of characters delimited by those "|". It should produce {2,1,1,2,4} as the result for the given example. I can think of using a loop, but what would be a simpler way to do that?

StringLength /@ StringSplit["aA|B|b|Ca|XYzz", "|"]