For "anytext", see this page.
Also take a look at the comments for atom_length/2.
Replacement
Here is simple code for a common stringy_length∕2
which refers to atom_length/2 and string_length/2 as needed. This already happens, but there is still this troubling naming specificity, which I would like to get rid of.