How to extent primitive recursion from natural numbers to finite strings?
You don't really need to do anything. Without loss of generality, let $\Sigma = \{0, \dots, d-1\}$.  A string in&nbsp;$\Sigma^*$ is (almost) just a natural number written in base-$d$. The only problem is that leading zeroes are significant in strings but not natural numbers so we instead associate the string $w_1\dots w_k\in\Sigma^k$ with the base-$d$ natural number that's written $1w_1\dots w_k$. The length function is just a suitably rounded logarithm, which is primitive-recursive anyway.

(The first way you'd try to compute a base-$d$ logarithm would probably be to use a while loop to repeatedly divide by&nbsp;$d$. But you can replace that with a for loop, since we know that $\log_d n\leq n$.)