我正在尝试实现一个消息计数器(用于计算在SMS中输入的字符数),这应该从160减少到零(对于第一页)增加第二页然后重新计数但是对于后续页面,此时间从159开始下降到0。我该怎么做
int pgNo;
public int PageNumber(int length, int maxchar) // this is for the page number
{
pgNo = ((length / maxchar) + 1);
return pgNo;
}
public int CharCount(int length, int maxchar)// this is for determining the count in that page
{
int num = length % maxchar; // num is the count of the page
if (num == 0 && length == 0) // checking to determine either 0 or maxchar is to be displayed
{
num = maxchar; // e.g. 0/100 or 100/100
}
return maxchar - num;
}