forked from urdt/ussd
add a zero pad value to unfilled profile item
This commit is contained in:
parent
1c7c0af712
commit
9e998f9a29
@ -9,6 +9,10 @@ func (p *Profile) InsertOrShift(index int, value string) {
|
|||||||
if index < len(p.ProfileItems) {
|
if index < len(p.ProfileItems) {
|
||||||
p.ProfileItems = append(p.ProfileItems[:index], value)
|
p.ProfileItems = append(p.ProfileItems[:index], value)
|
||||||
} else {
|
} else {
|
||||||
p.ProfileItems = append(p.ProfileItems, value)
|
for len(p.ProfileItems) < index {
|
||||||
|
p.ProfileItems = append(p.ProfileItems, "0")
|
||||||
|
}
|
||||||
|
p.ProfileItems = append(p.ProfileItems, "0")
|
||||||
|
p.ProfileItems[index] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user