请高手解释下VB中的一段退格代码

✀退格Private Sub Command5_Click()If zt = 1 Or zt = 3 ThenIf XSD = False ThenIf Len(Text1) > 2 ThenText1 = Left(Text1, Len(Text1) - 2) & "."(这个是什么意思)If Text1 = "-." Then Text1 = "0." (这句我也不懂)ElseText1 = "0."End IfElseIf Right(Text1, 1) = "." ThenXSD = FalseElseText1 = Left(Text1, Len(Text1) - 1)End IfEnd IfEnd IfEnd Sub请详细解释。谢谢!!
2026年09月27日 16:06
有2个网友回答
网友(1):

Text1 = Left(Text1, Len(Text1) - 2) & "."
变量 Text1 的值去掉它右边的两个字符,并加上"."
比如
Text1 = "abc王李刘麻子"
'现在 Text1 的值是"abc王李刘麻子"
Text1 = Left(Text1, Len(Text1) - 2) & "."
'现在 Text1 的值是 "abc王李刘."

If Text1 = "-." Then Text1 = "0."
如果 Text1 的值是"-." 那么把 Text1 的值改为"0."
如果 Text1 的值不是"-." ,本句无意义,Text1 值无变化。

网友(2):

Text1 = Left(Text1, Len(Text1) - 2) & "."
如果text1大于2个字符,则将最后两字符改为"."
If Text1 = "-." Then Text1 = "0."
如果出现"-."的情况,就将结果改为"0."的形式