判断字符串接结尾是否以回车结束
请问怎么判断字符串结尾是否以回车结束
If 字符串接结尾不是以回车结束 then
字符串=字符串+回车
End If
请问代码怎么写?
请各位赐教!
[解决办法]
try
Dim yourStr As String = " "
If yourStr.LastIndexOf( " " & Chr(10) & " ") <> yourStr.Length - 1 Then
yourStr = yourStr + " " & Chr(10) & " "
End If
[解决办法]
string str = "我的测试\n ";
if (str.EndsWith( "\n "))
{
Console.WriteLine( "以回车结束的字符 ");
}
[解决办法]
to:老百姓
\n是换行,不是回车吧?
[解决办法]
If Not s.EndsWith(ControlChars.NewLine) Then
s = s & ControlChars.NewLine
End If
[解决办法]
If Not s.EndsWith(vbCrlf) Then
s = s & vbCrlf
End If