I need to replace many different sub-string in a string in the most efficient way. is there another way other then the brute force way of replacing each field using string.replace ?
相关问题
- 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
Rythm a java template engine now released with an new feature called String interpolation mode which allows you do something like:
The above case shows you can pass argument to template by position. Rythm also allows you to pass arguments by name:
Note Rythm is VERY FAST, about 2 to 3 times faster than String.format and velocity, because it compiles the template into java byte code, the runtime performance is very close to concatentation with StringBuilder.
Links:
How about using the replaceAll() method?
Check this:
String.format(str,STR[])
...
For example:
String.format( "Put your %s where your %s is", "money", "mouth" );