The getText() returns the complete statement excluding the spaces between the words. One way of considering the spaces is to include them in grammar. But, is there any other way to get the complete String with the spaces considered.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Yes, there is (assuming here you are using
ParserRuleContext.getText()
. The idea is to ask the input char stream for a range of characters. The position values are stored in the start and stop tokens of the context.Here's some code (converted from C++, so it might not be 100% correct):
Since this retrieval function uses the absolute char indexes, it doesn't count in any possible whitespace rule.