Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
88aafb9b
Commit
88aafb9b
authored
May 08, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Excel导出功能
parent
576641ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
UrlHelper.java
.../src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
+30
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java
View file @
88aafb9b
package
com
.
yanzuoguang
.
util
.
helper
;
package
com
.
yanzuoguang
.
util
.
helper
;
import
com.yanzuoguang.util.contants.SystemContants
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.exception.CodeException
;
import
java.net.*
;
import
java.net.*
;
...
@@ -9,6 +10,7 @@ import java.util.List;
...
@@ -9,6 +10,7 @@ import java.util.List;
/**
/**
* 地址字符串处理
* 地址字符串处理
*
* @author 颜佐光
* @author 颜佐光
*/
*/
public
class
UrlHelper
{
public
class
UrlHelper
{
...
@@ -97,4 +99,32 @@ public class UrlHelper {
...
@@ -97,4 +99,32 @@ public class UrlHelper {
}
}
return
ipList
;
return
ipList
;
}
}
/**
* 处理是否斜线分隔符结尾
*
* @param url 需要处理的地址
* @return 处理后的结果
*/
public
static
String
dealWithUrl
(
String
url
)
{
if
(!
url
.
endsWith
(
SystemContants
.
SLASH
)
||
!
url
.
endsWith
(
SystemContants
.
UNSLASH
))
{
url
+=
SystemContants
.
SLASH
;
}
return
url
;
}
/**
* 处理双斜线
* <p>
* 1、\\ --> /
* 2、// --> /
*
* @param url 需要处理的地址
* @return 处理后的结果
*/
public
static
String
dealUrlDoubleChar
(
String
url
)
{
return
url
.
replaceAll
(
SystemContants
.
SLASH
+
SystemContants
.
SLASH
,
SystemContants
.
SLASH
).
replaceAll
(
SystemContants
.
UNSLASH
+
SystemContants
.
UNSLASH
,
SystemContants
.
SLASH
);
}
}
}
\ No newline at end of file
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