Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ea6982fc
authored
2014-08-05 23:52:06 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
beego: template fund when the start> len(bt)
1 parent
a3f40234
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
templatefunc.go
templatefunc_test.go
templatefunc.go
View file @
ea6982f
...
...
@@ -27,6 +27,9 @@ func Substr(s string, start, length int) string {
if
start
<
0
{
start
=
0
}
if
start
>
len
(
bt
)
{
start
=
start
%
len
(
bt
)
}
var
end
int
if
(
start
+
length
)
>
(
len
(
bt
)
-
1
)
{
end
=
len
(
bt
)
...
...
templatefunc_test.go
View file @
ea6982f
...
...
@@ -25,6 +25,9 @@ func TestSubstr(t *testing.T) {
if
Substr
(
s
,
0
,
100
)
!=
"012345"
{
t
.
Error
(
"should be equal"
)
}
if
Substr
(
s
,
12
,
100
)
!=
"012345"
{
t
.
Error
(
"should be equal"
)
}
}
func
TestHtml2str
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment