Browse Source

add CharSequenceUtil

Looly 5 years ago
parent
commit
7a03bbe93a

+ 1 - 0
CHANGELOG.md

@@ -14,6 +14,7 @@
 * 【json   】     JSONStrFormater改为JSONStrFormatter
 * 【dfa    】     增加FoundWord(pr#1290@Github)
 * 【core   】     增加Segment(pr#1290@Github)
+* 【core   】     增加CharSequenceUtil
 
 ### Bug修复
 * 【cache  】     修复Cache中get重复misCount计数问题(issue#1281@Github)

+ 8 - 0
hutool-core/pom.xml

@@ -5,6 +5,14 @@
 	<modelVersion>4.0.0</modelVersion>
 
 	<packaging>jar</packaging>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi</artifactId>
+			<version>4.1.2</version>
+			<scope>compile</scope>
+		</dependency>
+	</dependencies>
 
 	<parent>
 		<groupId>cn.hutool</groupId>

File diff suppressed because it is too large
+ 4231 - 0
hutool-core/src/main/java/cn/hutool/core/text/CharSequenceUtil.java


File diff suppressed because it is too large
+ 187 - 4344
hutool-core/src/main/java/cn/hutool/core/util/StrUtil.java


+ 30 - 0
hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java

@@ -66,6 +66,36 @@ import java.util.Map;
 public class XmlUtil {
 
 	/**
+	 * 字符串常量:XML 空格转义 {@code "&nbsp;" -> " "}
+	 */
+	public static final String NBSP = "&nbsp;";
+
+	/**
+	 * 字符串常量:XML And 符转义 {@code "&amp;" -> "&"}
+	 */
+	public static final String AMP = "&amp;";
+
+	/**
+	 * 字符串常量:XML 双引号转义 {@code "&quot;" -> "\""}
+	 */
+	public static final String QUOTE = "&quot;";
+
+	/**
+	 * 字符串常量:XML 单引号转义 {@code "&apos" -> "'"}
+	 */
+	public static final String APOS = "&apos;";
+
+	/**
+	 * 字符串常量:XML 小于号转义 {@code "&lt;" -> "<"}
+	 */
+	public static final String LT = "&lt;";
+
+	/**
+	 * 字符串常量:XML 大于号转义 {@code "&gt;" -> ">"}
+	 */
+	public static final String GT = "&gt;";
+
+	/**
 	 * 在XML中无效的字符 正则
 	 */
 	public static final String INVALID_REGEX = "[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]";

+ 7 - 0
hutool-extra/src/main/java/cn/hutool/extra/spring/package-info.java

@@ -0,0 +1,7 @@
+/**
+ * Spring相关工具封装
+ * 
+ * @author looly
+ *
+ */
+package cn.hutool.extra.spring;

+ 8 - 8
hutool-extra/src/test/java/cn/hutool/extra/spring/EnableSprintUtilTest.java

@@ -10,15 +10,15 @@ import org.springframework.test.context.junit4.SpringRunner;
  * @author sidian
  */
 @RunWith(SpringRunner.class)
-@SpringBootTest(classes = EnableSprintUtilTest.class)
+@SpringBootTest(classes = EnableSpringUtilTest.class)
 @EnableSpringUtil
-public class EnableSprintUtilTest {
+public class EnableSpringUtilTest {
 
-    @Test
-    public void test() {
-        // 使用@EnableSpringUtil注解后, 能获取上下文
-        Assert.assertNotNull(SpringUtil.getApplicationContext());
-        // 不使用时, 为null
+	@Test
+	public void test() {
+		// 使用@EnableSpringUtil注解后, 能获取上下文
+		Assert.assertNotNull(SpringUtil.getApplicationContext());
+		// 不使用时, 为null
 //        Assert.assertNull(SpringUtil.getApplicationContext());
-    }
+	}
 }