@Trim in evaluate statement

Hello All,

When i try to use @trim in an evaluate statement, the output is not as expected can anyone help me out to fix this issue.

My code :

            Dim strD As String

	Dim newVal As Variant

	strD = exitData(0)

	newVal = Evaluate({@Trim(strD)})

	newArr(count) = newVal(0)

I am getting a null value as a output for the above code. But when i hardcode as below its working fine.

            Dim newVal As Variant

	newVal = Evaluate({@Trim("My     Text")})

	newArr(count) = newVal(0)

any help would be appreciated. Thanks in advance

Subject: Why not use LS native command FullTrim?

Subject: @Trim in evaluate statement

“Fulltrim” would be the better solution here, but if you’re wanting to use “Evaluate”, you have to understand that you’re building a string to be evaluated. Thus, “strD” in your current code is considered part of the string that you’re evaluating. Notes doesn’t have a value for that “variable”, so it’s null.

What you’re wanting to do is:

newVal = Evaluate ( {@Trim (} & strD & {)} )

…so that the VALUE of strD gets inserted into the string to evaluate.

Subject: RE: @Trim in evaluate statement

What you would do is actually this:

newVal = Evaluate ( {@Trim (“} & strD & {”)} )

but I agree with David and Mary Anne that you should use FullTrim instead.

/Peter

Subject: RE: @Trim in evaluate statement

Thanks for all you people help. Its working great with FullTrim method :slight_smile: