Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
common
Commits
532b380d
Commit
532b380d
authored
Jan 11, 2021
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
db81d321
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
MathUtil.java
src/main/java/com/egolm/common/MathUtil.java
+5
-1
StringUtil.java
src/main/java/com/egolm/common/StringUtil.java
+13
-0
No files found.
src/main/java/com/egolm/common/MathUtil.java
View file @
532b380d
...
@@ -42,5 +42,9 @@ public class MathUtil {
...
@@ -42,5 +42,9 @@ public class MathUtil {
return
(
T
)
k
;
return
(
T
)
k
;
}
}
public
static
int
random
(
int
min
,
int
max
)
{
Random
random
=
new
Random
();
return
random
.
nextInt
(
max
)
%
(
max
-
min
+
1
)
+
min
;
}
}
}
src/main/java/com/egolm/common/StringUtil.java
View file @
532b380d
...
@@ -17,6 +17,7 @@ import java.util.Comparator;
...
@@ -17,6 +17,7 @@ import java.util.Comparator;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.UUID
;
import
java.util.UUID
;
...
@@ -53,6 +54,18 @@ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombi
...
@@ -53,6 +54,18 @@ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombi
*/
*/
public
class
StringUtil
{
public
class
StringUtil
{
private
static
final
String
str
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
public
static
String
getRandomString
(
int
length
){
Random
random
=
new
Random
();
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
length
;
i
++){
int
number
=
random
.
nextInt
(
62
);
sb
.
append
(
str
.
charAt
(
number
));
}
return
sb
.
toString
();
}
public
static
String
join
(
Map
<
String
,
Object
>
map
,
String
sign
,
String
before
,
String
after
,
String
joinKey
)
{
public
static
String
join
(
Map
<
String
,
Object
>
map
,
String
sign
,
String
before
,
String
after
,
String
joinKey
)
{
sign
=
sign
==
null
?
""
:
sign
;
sign
=
sign
==
null
?
""
:
sign
;
before
=
before
==
null
?
""
:
before
;
before
=
before
==
null
?
""
:
before
;
...
...
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