title: Extract decimal from start of string
body: <p>I have a string like <code>5.5kg</code> or <code>7.90gram</code> and I want to get <code>5.5</code> or <code>7.90</code> as a decimal value. How can I get such result in C# and one more thing that my string will always starts with decimal. </p>
  
  <p>Here is my code that throws an error whenever it will encounter anything except a decimal.</p>
  
  <pre><code>string weight = attributeValue;
  if (!string.IsNullOrEmpty(weight))
  {
      product.Weight = Convert.ToDecimal(attributeValue);
  }
  else
  {
      product.Weight = 0.00m;
  }
  </code></pre>