java - What's the StringBuffer alternative for String.endsWith? -


i have been using string in concurrent application , make code more optimized,i have use stringbuffer instead of string? confused alternative of string.endswith("\\") stringbuffer. method of stringbuffer should used mentioned purpose?

there no direct api. try try stringbuffer.lastindexof("\\")==stringbuffer.length()-1

or

stringbuffer.charat(stringbuffer.length()-1)=='\\'

ps : above code samples untested.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -