我怎样才能检查一个string的长度为48个字符,如果是要长时间剪切所有超过的字符

我如何检查48个字符的string长度,如果要长时间剪切所有超过48个字符的字符? 我想在代码(在IF和ELSE)下面的Sym.Description2做到这一点。 例如System.Description =“Ihavetomanycharactersinthisstringiwanttocutthisnow”一个50个字符的string。 因此,这应该是新的string:Sym.Description2 =“Ihavetomanycharactersinthisstringiwanttocutthisn”,正好是48个字符。 我想在VBA中做到这一点。

'Description(2) field If System.Description <> "" Then Sym.Description2 = System.Description Else Sym.Description2 = System.Name End If 

谢谢您的帮助 :)

LEFT(Sym.Description2,48)只返回前48个字符,您可以直接在VBA或Excel中使用它。