This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new 944608b  [LANG-1679] Improve performance of StringUtils.unwrap(String, 
String) (#844)
944608b is described below

commit 944608b854202c39da9cf6508f300fa9e91ae321
Author: cloverandwang <97072479+cloverandw...@users.noreply.github.com>
AuthorDate: Sun Apr 3 22:20:34 2022 +0800

    [LANG-1679] Improve performance of StringUtils.unwrap(String, String) (#844)
---
 src/main/java/org/apache/commons/lang3/StringUtils.java | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java 
b/src/main/java/org/apache/commons/lang3/StringUtils.java
index b150e92..8b1c5d2 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -9425,13 +9425,7 @@ public class StringUtils {
         }
 
         if (startsWith(str, wrapToken) && endsWith(str, wrapToken)) {
-            final int startIndex = str.indexOf(wrapToken);
-            final int endIndex = str.lastIndexOf(wrapToken);
-            final int wrapLength = wrapToken.length();
-
-            if (startIndex != -1 && endIndex != -1) {
-                return str.substring(startIndex + wrapLength, endIndex);
-            }
+            return str.substring(wrapToken.length(), 
str.lastIndexOf(wrapToken));
         }
 
         return str;

Reply via email to