# Math Eqn

How to handle 50,000 characters in a string variable for calculating mathematical expressions. I tried with the string builder, in the string builder the value is stored and I was unable to retrieve all the characters using Get as string() method. How to retrieve all the characters using the variable. Pls, anyone help me to solve this.

It was working with 4000 characters but unable to retrieve the highest characters

please post the part of your code that doesn’t work as expected.

Dim total As Double
Dim result as String
dim sb as new Chilkat.StringBuilder
Dim success As Boolean

result =ReplaceAll(expected,“LinZcom”,LinZcom)
result =ReplaceAll(result,“RotYext”,RotYext)
result =ReplaceAll(result,“CAirBag”,CAirBag)
result =ReplaceAll(result,“KBDistn”,KBDistn)
result =ReplaceAll(result,“ShellTk”,ShellTk)
result =ReplaceAll(result,“ZAcceSF”,ZAcceSF)
result =ReplaceAll(result,“SeatFri”,SeatFri)
result =ReplaceAll(result,“SBPTtim”,SBPTtim)

success = sb.Append(result)

Dim myEval As New ExpressionEvaluator

dim ParseStatus As Boolean = myEval.Parse(sb.GetAsString())

if ParseStatus then
myEval.Eval
TextArea1.Text="result: "+str(myEval.Result)+EndOfLine
Else
End If

/////

In the Parse method, I was not able to calculate it.

The final output i got is NAN(IND)

why do you use a Chilkat.StringBuilder for sb and not a simple xojo String ?

yes because I am storing the string value in String builder using the append method and then I will retrieve the value as sb.get asString()… because in a simple string it is not calculating it, so only I am using string builder for 50000 characters.

[code]Public Sub Append(extends byref astring as String, toAppendText as String)
'---------------------------------------------------------------------------------
’ appends the toAppendText string at the end of aString
'---------------------------------------------------------------------------------

astring = astring + toAppendText

End Sub
[/code]

then you can use sb as a simple string.
may be your problem is in stringbuilder that doesn’t handle 50000 chars ?

After applying this method in xojo I am facing this issue “The extends modifier cannot be used on a class method” So pls help me to solve this I am the beginner in xojo.

the “Append” method must be in a module with global access, not in a class.

Hello Sir I tried with your points I am facing the same error again, I created a variable using Dim statement, In that variable how to call the append method, Sir Please help me to solve this Can you provide few examples about Append method because it will be easier to fix it, Pls help it…