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
11852664
Commit
11852664
authored
May 12, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复等待时间
parent
e991d17e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
CollectionString.java
...main/java/com/yanzuoguang/util/base/CollectionString.java
+5
-4
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/base/CollectionString.java
View file @
11852664
...
@@ -104,7 +104,8 @@ public class CollectionString {
...
@@ -104,7 +104,8 @@ public class CollectionString {
* @return 字符串的长度
* @return 字符串的长度
*/
*/
public
static
int
length
(
String
value
)
{
public
static
int
length
(
String
value
)
{
int
valueLength
=
0
;
int
chLength
=
0
;
int
enLength
=
0
;
String
chinese
=
"[\u0391-\uFFE5]"
;
String
chinese
=
"[\u0391-\uFFE5]"
;
/* 获取字段值的长度,如果含中⽂字符,则每个中⽂字符长度为2,否则为1 */
/* 获取字段值的长度,如果含中⽂字符,则每个中⽂字符长度为2,否则为1 */
for
(
int
i
=
0
;
i
<
value
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
value
.
length
();
i
++)
{
...
@@ -113,12 +114,12 @@ public class CollectionString {
...
@@ -113,12 +114,12 @@ public class CollectionString {
/* 判断是否为中⽂字符 */
/* 判断是否为中⽂字符 */
if
(
temp
.
matches
(
chinese
))
{
if
(
temp
.
matches
(
chinese
))
{
/* 中⽂字符长度为2 */
/* 中⽂字符长度为2 */
valueLength
+=
2
;
chLength
++
;
}
else
{
}
else
{
/* 其他字符长度为1 */
/* 其他字符长度为1 */
valueLength
+=
1
;
enLength
++
;
}
}
}
}
return
value
Length
;
return
chLength
*
5
/
3
+
en
Length
;
}
}
}
}
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