Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
be25a432
Commit
be25a432
authored
Mar 07, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动态删除行为换行
parent
393baa72
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
+6
-1
src/main/java/cn/meteor/beyondclouds/util/TopicUtils.java
+6
-1
No files found.
src/main/java/cn/meteor/beyondclouds/util/TopicUtils.java
View file @
be25a432
...
@@ -23,9 +23,13 @@ public class TopicUtils {
...
@@ -23,9 +23,13 @@ public class TopicUtils {
private
static
final
Pattern
delayPattern
=
Pattern
.
compile
(
"(delay\\((\\d+)\\);)$"
);
private
static
final
Pattern
delayPattern
=
Pattern
.
compile
(
"(delay\\((\\d+)\\);)$"
);
private
static
final
Pattern
tailLFPattern
=
Pattern
.
compile
(
"(\n+)$"
);
public
static
String
encodeTopic
(
String
str
)
{
public
static
String
encodeTopic
(
String
str
)
{
Assert
.
hasText
(
str
,
"str must not be empty"
);
Assert
.
hasText
(
str
,
"str must not be empty"
);
str
=
str
.
replaceAll
(
tailLFPattern
.
pattern
(),
""
);
Matcher
matcher
=
topicPattern
.
matcher
(
str
);
Matcher
matcher
=
topicPattern
.
matcher
(
str
);
StringBuffer
buffer
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
...
@@ -66,6 +70,7 @@ public class TopicUtils {
...
@@ -66,6 +70,7 @@ public class TopicUtils {
}
}
public
static
Integer
getDelay
(
String
str
)
{
public
static
Integer
getDelay
(
String
str
)
{
str
=
str
.
replaceAll
(
tailLFPattern
.
pattern
(),
""
);
Matcher
matcher
=
delayPattern
.
matcher
(
str
);
Matcher
matcher
=
delayPattern
.
matcher
(
str
);
if
(
matcher
.
find
())
{
if
(
matcher
.
find
())
{
return
Integer
.
valueOf
(
matcher
.
group
(
2
));
return
Integer
.
valueOf
(
matcher
.
group
(
2
));
...
@@ -76,7 +81,7 @@ public class TopicUtils {
...
@@ -76,7 +81,7 @@ public class TopicUtils {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
// System.out.println(TopicUtils.parseTopics("#哈哈哈#今#哈哈哈#天你吃饭了吗#吃了#######"));
// System.out.println(TopicUtils.parseTopics("#哈哈哈#今#哈哈哈#天你吃饭了吗#吃了#######"));
System
.
out
.
println
(
TopicUtils
.
encodeTopic
(
"
#哈哈哈#今#哈哈delay(5);哈#天你吃饭了吗#吃了#######哈哈#a#bdelay(5);
"
));
System
.
out
.
println
(
TopicUtils
.
encodeTopic
(
"
\n\n#哈哈哈#今#哈哈delay(5);哈#天你吃饭了吗#吃了#######哈哈#a#bdelay(5);\n\n
"
));
System
.
out
.
println
(
TopicUtils
.
getDelay
(
"#哈哈哈#今#哈哈delay(5);哈#天你吃饭了吗#吃了#######哈哈#a#bdelay(5);"
));
System
.
out
.
println
(
TopicUtils
.
getDelay
(
"#哈哈哈#今#哈哈delay(5);哈#天你吃饭了吗#吃了#######哈哈#a#bdelay(5);"
));
// System.out.println(TopicUtils.clearLockedTopics("#哈哈哈#今#哈哈哈#天你吃饭了吗#吃了#######哈哈#a#b", List.of("哈哈哈")));
// System.out.println(TopicUtils.clearLockedTopics("#哈哈哈#今#哈哈哈#天你吃饭了吗#吃了#######哈哈#a#b", List.of("哈哈哈")));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment