You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/06/28 19:26:04 UTC
[commons-text] 05/06: Add Add
org.apache.commons.text.TextStringBuilder.toString(int, int).
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-text.git
commit acf5e1baa28e5bdf0134b5abc7f7895381a73242
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jun 28 15:10:26 2020 -0400
Add Add org.apache.commons.text.TextStringBuilder.toString(int, int).
---
src/changes/changes.xml | 1 +
.../java/org/apache/commons/text/TextStringBuilder.java | 14 ++++++++++++++
2 files changed, 15 insertions(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bf5a2d5..d10edb9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -57,6 +57,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.commons.text.matcher.StringMatcher.isMatch(CharSequence, int, int, int).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.commons.text.lookup.StringLookupFactory.functionStringLookup(Function<String, V>).</action>
<action type="add" dev="ggregory" due-to="Gary Gregory">Add BiStringLookup and implementation BiFunctionStringLookup.</action>
+ <action type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.commons.text.TextStringBuilder.toString(int, int).</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">[test] junit-jupiter 5.5.1 -> 5.5.2.</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">[test] org.assertj:assertj-core 3.13.2 -> 3.16.1.</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">[build] com.puppycrawl.tools:checkstyle 8.23 -> 8.27.</action>
diff --git a/src/main/java/org/apache/commons/text/TextStringBuilder.java b/src/main/java/org/apache/commons/text/TextStringBuilder.java
index b94be8d..58af923 100644
--- a/src/main/java/org/apache/commons/text/TextStringBuilder.java
+++ b/src/main/java/org/apache/commons/text/TextStringBuilder.java
@@ -3174,6 +3174,20 @@ public class TextStringBuilder implements CharSequence, Appendable, Serializable
}
/**
+ * Extracts a portion of this string builder as a string.
+ *
+ * @param startIndex The initial offset
+ * @param count the desired length
+ * @return The new string
+ * @throws IndexOutOfBoundsException if the index is invalid
+ * @since 1.9
+ */
+ public String toString(final int startIndex, int count) {
+ validateRange(startIndex, startIndex + count);
+ return new String(buffer, startIndex, count);
+ }
+
+ /**
* Gets a StringBuffer version of the string builder, creating a new instance each time the method is called.
*
* @return The builder as a StringBuffer