title: How to to get part of the string
body: <p>The following function can return 9 digits from the string.</p>
  
  <p>my question is if I pass abc="123456" which means its low than 9 digits.It shows error.I need maximum 9 digits from the given strings.if I pass six digit ,I need the six digit string instead of the Error.</p>
  
  <pre><code>public string test()
  {
    string abc="asdhfjsdfkjhfiovjalksdhafbvklxkjszjhd";
    return abc.Substring(0, 9);
  }
  </code></pre>