获取字符串预览

Mic*_*ard 0 c# asp.net string character

我正在寻找的是一种预览字符串的方法.假设我的字符串长度为150个字符.但我只想显示前50个字符.

Rob*_*b I 7

试试s.Substring(0,Math.Min(s.Length,50)).

  • 不应该是`Math.Min`? (2认同)