How to evaluate the value of PsiJavaToken of STRING_LITERAL type

I have PsiJavaToken of type STRING_LITERAL. How can I calcuate the value of the literal?

3 comments

Hello Hello,

I have PsiJavaToken of type STRING_LITERAL. How can I calcuate the
value of the literal?


PsiJavaToken.getText()

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Hello Hello,

I have PsiJavaToken of type STRING_LITERAL. How can I calcuate the
value of the literal?


Or, rather, find its parent of type PsiLiteralExpression and use getValue()
method. That will expand the escape sequences etc.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.