序列号生成一年 [英] serial number generated for one year

查看:141
本文介绍了序列号生成一年的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自动生成的序列号生成一年

解决方案

假设您的意思是:如何生成包含给定年份的序列号?,答案很简单:用计数器连接年份,例如

 20140001 
20140002
...



实际实施是微不足道的,留作练习。



[update (没有人喜欢练习了) )]

 公共 功能 NextCode( ByVal 作为 整数 ByRef 计数器作为 整数作为 整数 
counter = counter + 1
Ne xtCode =年* 10000 + counter

结束 功能



请注意,这真的是一个天真的实现。 必须写更强大的代码。

[/ update]


只需连接一年编号

Auto generated serial number generated for one year

解决方案

Assuming you meant: "how to generate a serial number including a given year?", the answer is pretty simple: concatenate the year with a counter, e.g.

20140001
20140002
...


The actual implementation is trivial and left as an exercise.

[update (no one likes exercises anymore)]

Public Function NextCode(ByVal year As Integer, ByRef counter As Integer) As Integer
  counter = counter + 1
  NextCode = year * 10000 + counter

End Function


Please note, that's really a naive implementation. You have to write more robust code.
[/update]


Just Concatenate a year to Number


这篇关于序列号生成一年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆