Trim Issue --- trim(string) and string.trim

Few year ago, i use string.trim to remove a space of string, but it failed, then i use trim(string), and it worked. Few years later, trim(string) report error as ‘Trim’ is a type and cannot be used as an expression.

Is there any solution for handle this? i don’t want to update to string.trim one by one.
studio version: 2022.10.13

Hi,

What variable type is M_PolicyNumber?
If String type, M_PolicyNumber.Trim() will work.

If you need to use static method for some reason, Strings.Trim(M_PolicyNumber) may help you. (If we import Microsoft.VisualBasic namespace in Imports panel, Trim(M_PolicyNumber) may work.

Regards,

M_Policynumber.trim() didn’t solve my issue in my situation, that’s why i changed to trim(string). and now strings.trim(variable) works well now. thanks for your solutions.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.