1
以下代码会引发错误
'索引和长度必须引用字符串中的位置。参数名称:长度'。索引和长度错误 - 任何更好的逻辑...?
Sub Main()
Dim Ex As String
Dim yy As String =
(If(String.IsNullOrEmpty(Ex), "", Ex)).ToString().Substring(0, 1000)
End Sub
从上面的代码可以明显看出,错误是由于字符串Ex而导致的。
但要解决这个问题
1. Need to check
a. Whether the string is Null Or Empty
b. If not,
a. Has more than 1000 chars.....? extract 1000 chars.
b. Else use the string as it is.
要实现上面的逻辑,需要至少2如果条款。
我们是否有更好的逻辑来实现上述...?
在此先感谢。
哇...左()看起来很酷.....谢谢。 – Sunil