I'd like to know how to replace parts of a string in LaTeX. Specifically I'm given a measurement (like 3pt, 10mm, etc) and I'd like to remove the units of that measurement (so 3pt-->3, 10mm-->10, etc). The reason why I'd like a command to do this is in the following piece of code:
\newsavebox{\mybox}
\sbox{\mybox}{Hello World!}
\newlength{\myboxw}
\settowidth{\myboxw}{\usebox{\mybox}}
\begin{picture}(\myboxw,\myboxw)
\end{picture}
Basically I create a savebox
called mybox. I insert the words "Hello World" into mybox. I create a new length, called myboxw. I then get the width of mybox, and store this in myboxw. Then I set up a square picture
environment whose dimensions correspond to myboxw. The trouble is that myboxw is returning something of the form "132.56pt", while the input to the picture
environment has to be dimensionless: \begin{picture}{132.56, 132.56}
.
So, I need a command which will strip the units of measurement from a string.