\documentclass[pdftex,a4paper,12pt,oneside]{book}%
\usepackage{xstring}
\begin{document}
\newcommand{\tmpa}{}
\newcommand{\tmpb}{}
\newcommand{\tmpc}{}
\renewcommand{\tmpc}{abcdefg} \noindent tmpc: \tmpc \\
\renewcommand{\tmpa}{\meaning\tmpc} tmpa: \tmpa \\
len: \StrLen{\tmpa} \\
char(20): \StrChar{\tmpa}{20}[\tmpb] \tmpb \\
pos(f): \StrPosition{\tmpa}{f}
\end{document}
Result:
tmpc: abcdefg
tmpa: \long macro:->abcdefg
len: 21
char(20): f
pos(f): 0
Why? tmpa obviously contains character 'f' on the position of 20 as we can find it with \StrChar. But that 'f' not the same as the one we are trying to find with StrPos. I thought about catcode differences, but did not find anything usable (I might be wrong with changing catcode of 'f' before searching for it).
