title: C# function to convert text input of feet/inches/meters/centimeters/millimeters into numeric values
body: <p>I'm writing a function to take shorthand values and convert them into a standardized numeric format.  Is there any standard code out there that would do "best possible" conversion of arbitrary measurement text and turn it into numeric measurements if the text is valid?</p>
  
  <p>I guess I'm looking for something like bool TryParseMeasurement(string s, out decimal d).  Does anyone know of a function like this?</p>
  
  <p>Here's an example of some of the input values I've seen:</p>
  
  <p>Imperial</p>
  
  <ul>
  <li>6 inches</li>
  <li>6in</li>
  <li>6”</li>
  <li>4 feet 2 inches</li>
  <li>4’2”</li>
  <li>4 ‘ 2 “</li>
  <li>3 feet</li>
  <li>3’</li>
  <li>3 ‘</li>
  <li>3ft</li>
  <li>3ft10in</li>
  <li>3ft 13in (should convert to 4’1”)</li>
  </ul>
  
  <p>Metricc</p>
  
  <ul>
  <li>1m</li>
  <li>1.2m</li>
  <li>1.321m</li>
  <li>1 meter</li>
  <li>481mm</li>
  </ul>