Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
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
首航-临时账号
api
Commits
7ca35260
Commit
7ca35260
authored
Mar 29, 2019
by
java-李谡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改号码格式化
parent
0d005762
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
Util.java
src/com/ejweb/core/util/Util.java
+10
-8
No files found.
src/com/ejweb/core/util/Util.java
View file @
7ca35260
...
...
@@ -250,13 +250,13 @@ public class Util {
if
(
mobile
==
null
||
mobile
.
length
()
==
0
)
return
mobile
;
try
{
String
[]
species
=
mobile
.
split
(
"\\s+"
);
// 只使用第一个手机号
if
(
species
.
length
>
1
&&
species
[
0
].
matches
(
"1\\d+"
)
&&
species
[
1
].
matches
(
"1\\d+"
)){
mobile
=
species
[
0
];
}
//
String[] species = mobile.split("\\s+");// 只使用第一个手机号
//
if(species.length>1 && species[0].matches("1\\d+") && species[1].matches("1\\d+")){
//
//
mobile = species[0];
//
}
mobile
=
mobile
.
replaceAll
(
"+"
,
"+"
);
// 处理错误字符
mobile
=
mobile
.
replaceAll
(
"[^0-9|+]+"
,
""
);
// 将非电话号码替换为空
mobile
=
mobile
.
replaceAll
(
"[^0-9
^,^#
|+]+"
,
""
);
// 将非电话号码替换为空
// System.out.println("mobile:"+mobile);
if
(
mobile
.
startsWith
(
"+"
)){
// 国外手机号,前面加拨3个0
...
...
@@ -297,7 +297,7 @@ public class Util {
if
(
workPhone
==
null
||
workPhone
.
length
()
==
0
)
return
workPhone
;
try
{
workPhone
=
workPhone
.
replaceAll
(
"[^\\d|+]+"
,
""
);
workPhone
=
workPhone
.
replaceAll
(
"[^\\d
^,^#
|+]+"
,
""
);
if
(
workPhone
.
matches
(
"0+"
)){
// 非座机号设置为空
workPhone
=
""
;
}
else
if
(
workPhone
.
startsWith
(
"0"
)
==
false
){
// 非0开头的号码需要处理
...
...
@@ -766,6 +766,8 @@ public class Util {
//// System.out.println(Util.getRelativePath("https://ifos.jdair.net/foc/static/2017/01/13/actuals/images/user/jpg/23198d70826ac171ee03ed5cd3d14c27.jpg"));
// }
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
Util
.
entryptPassword
(
"123456"
));
System
.
out
.
println
(
Util
.
formatedWorkPhone
(
"00016462485041,9694264088,053601046310#"
));
}
}
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