Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
ea6982fc
Commit
ea6982fc
authored
Aug 05, 2014
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beego: template fund when the start> len(bt)
parent
a3f40234
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
templatefunc.go
templatefunc.go
+3
-0
templatefunc_test.go
templatefunc_test.go
+3
-0
No files found.
templatefunc.go
View file @
ea6982fc
...
...
@@ -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 @
ea6982fc
...
...
@@ -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
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