title: Limit Character count in c# String
body: <p>I have this code, is there an easy way to limit the amount of characters displayed to 250?</p>
  
  <pre><code>&lt;%# trimIt(DataBinder.Eval(Container.DataItem, "WebSalesText").ToString())%&gt;
  
  public string trimIt(string s)
  {
      if (s.Length &gt; 0 &amp;&amp; s.IndexOf(".") &gt; 0)
      {
          return (s.Substring(0, s.IndexOf(".")) + " ...");
      }
      else
      {
          return s;
      }
  }
  </code></pre>