写在前面

  最近有个项目需要这么个计算学期的函数,写完之后顺便分享一下。这就是一个很简单的函数,也不需要什么高深的算法什么的。

函数

implementation
uses System.SysUtils;
function whichTerm(year:string;month:string):string;
  begin
    if (StrToInt(month)>=8) then
    begin
      Result:=year+'-'+IntToStr(StrtoInt(year)+1)+'-'+IntToStr(1) ;
    end
    else
    begin
      Result:=IntToStr(StrtoInt(year)-1)+'-'+year+'-'+IntToStr(2);
    end;
  end;

end.

运行截图

mark

源码获取

臾离云[download]http://download.xgblack.top/?dir=myowncode/Delphi/getTerm[/download]
GitHub[download]https://github.com/xg-gmg/getThisTerm[/download]
码云[download]https://gitee.com/xgblack/getThisTerm[/download]