Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sap-service
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
曲欣亮
sap-service
Commits
80ff848d
Commit
80ff848d
authored
Jul 26, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
c9886ad7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
+23
-21
StringUtil.java
src/main/java/com/egolm/sso/util/StringUtil.java
+23
-21
No files found.
src/main/java/com/egolm/sso/util/StringUtil.java
View file @
80ff848d
...
...
@@ -14,44 +14,42 @@ import org.dom4j.Element;
public
class
StringUtil
{
public
static
Double
toDouble
(
String
value
)
{
Double
res
;
if
(
value
==
null
||
value
.
equals
(
""
))
{
res
=
0.0
;
}
else
{
res
=
Double
.
valueOf
(
value
);
if
(
value
==
null
||
value
.
equals
(
""
))
{
return
null
;
}
else
{
return
Double
.
valueOf
(
value
);
}
return
res
;
}
public
static
String
prependZero
(
int
Num
,
int
length
)
{
return
prependZero
(
Num
+
""
,
length
);
return
prependZero
(
Num
+
""
,
length
);
}
public
static
String
prependZero
(
String
Num
,
int
length
)
{
String
prepend
=
""
;
for
(
int
i
=
Num
.
length
();
i
<
length
;
i
++)
{
for
(
int
i
=
Num
.
length
();
i
<
length
;
i
++)
{
prepend
=
prepend
+
"0"
;
}
return
prepend
+
Num
;
}
public
static
Element
getDataElement
(
String
xml
,
String
eName
)
{
Document
doc
=
null
;
Element
el
=
null
;
try
{
doc
=
DocumentHelper
.
parseText
(
xml
);
doc
=
DocumentHelper
.
parseText
(
xml
);
Element
root
=
doc
.
getRootElement
();
el
=
root
.
element
(
eName
);
}
catch
(
DocumentException
e
)
{
e
.
printStackTrace
();
}
e
.
printStackTrace
();
}
return
el
;
}
public
static
String
join
(
String
sign
,
String
before
,
String
after
,
String
def
,
List
<
String
>
strs
)
{
return
join
(
sign
,
before
,
after
,
def
,
strs
.
toArray
(
new
String
[
strs
.
size
()]));
}
public
static
String
join
(
String
sign
,
String
before
,
String
after
,
String
def
,
String
[]
strs
)
{
if
(
strs
==
null
||
strs
.
length
==
0
)
{
return
def
==
null
?
""
:
def
;
...
...
@@ -59,30 +57,34 @@ public class StringUtil {
StringBuffer
sb
=
new
StringBuffer
(
""
);
for
(
int
i
=
0
;
i
<
strs
.
length
;
i
++)
{
String
str
=
String
.
valueOf
(
strs
[
i
]);
sb
.
append
((
i
==
0
&&
before
!=
null
)
?
before
:
""
).
append
(
str
==
null
?
""
:
str
).
append
(
i
<
strs
.
length
-
1
?
(
sign
==
null
?
""
:
sign
)
:
""
).
append
((
i
==
strs
.
length
-
1
&&
after
!=
null
)
?
after
:
""
);
sb
.
append
((
i
==
0
&&
before
!=
null
)
?
before
:
""
).
append
(
str
==
null
?
""
:
str
)
.
append
(
i
<
strs
.
length
-
1
?
(
sign
==
null
?
""
:
sign
)
:
""
)
.
append
((
i
==
strs
.
length
-
1
&&
after
!=
null
)
?
after
:
""
);
}
return
String
.
valueOf
(
sb
);
}
}
public
static
String
join
(
String
str
,
String
sign
,
int
count
,
String
before
,
String
after
)
{
if
(
str
==
null
||
count
==
0
)
{
return
""
;
}
else
{
StringBuffer
sb
=
new
StringBuffer
(
""
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
sb
.
append
(
i
==
0
&&
before
!=
null
?
before
:
""
).
append
(
str
).
append
(
i
<
count
-
1
?
(
sign
==
null
?
""
:
sign
)
:
""
).
append
(
i
==
count
-
1
&&
after
!=
null
?
after
:
""
);
sb
.
append
(
i
==
0
&&
before
!=
null
?
before
:
""
).
append
(
str
)
.
append
(
i
<
count
-
1
?
(
sign
==
null
?
""
:
sign
)
:
""
)
.
append
(
i
==
count
-
1
&&
after
!=
null
?
after
:
""
);
}
return
String
.
valueOf
(
sb
);
}
}
public
static
String
format
(
Object
no
,
String
format
)
{
String
strno
=
String
.
valueOf
(
no
);
Integer
index
=
format
.
length
()
-
strno
.
length
();
return
format
.
substring
(
0
,
index
)
+
strno
;
}
public
static
String
readText
(
String
path
)
throws
IOException
{
BufferedReader
br
=
null
;
try
{
...
...
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