我正在使用vb.net 2010,我想提取当前年份的最后两位数字。
例如,2013应该返回13
我使用下面的代码:在vb.net上执行string.substring时出错
Dim sid_1 As String = Year(Now) 'or Year(Now).ToString
sid_1 = sid_1.Substring(sid_1.Length, 2) 'highlighted error
但它返回一个错误:
ArgumentOutOfRangeException was unhandled
Index and length must refer to a location with the string.
Parameter name: length
谢谢@SysDragon。我将使用这个而不是子字符串。但我不能接受这个答案,因为我的问题标题是'substring'。这是我的错误,我希望你不介意。 – 2013-02-15 06:25:04
@paynet当然,如果这可以解决您的问题:“当您确定哪个答案对您最有帮助时,通过单击答案左侧的复选框轮廓将其标记为接受的答案“。在[常见问题]上重写(http://stackoverflow.com/faq#howtoask)。 – SysDragon 2013-02-15 06:28:24
你走了。 XD – 2013-02-15 06:29:40