Substring to shrink result to 7000 characters

Ok I have a field I return that often exceeds 8000 characters and thus won't import into MySQL.

In order to capture just the first 7000 characters I tried this:

void shrinklength(String varName)
(
if (session.getVariable(varName) != null)
session.setVariable(varName, session.getVariable(varName).substring(1,7000));
)

shrinklength("variable");

Bu ti get this error:

The error message was: Encountered "shrinklength ( String varName ) (" at line 13, column 6...

when I run the scrpaing session.

Any ideas, it seemed pretty simple to me.

thanks in advance

I would need to see the

I would need to see the actual script to be sure, but you might try removing the variable type decelerations; sometimes NetBeans dislikes human opinions on what type of variable it's looking at.

You mean try this?

void shrinklength(varName)
(
if (session.getVariable(varName) != null)
session.setVariable(varName, session.getVariable(varName).substring(1,7000));
)

That seems easy enough. Not being a java programmer, I am never sure what to do. And the book I got is quite daunting :)

Thanks.