我想知道如何制作弦枕 [英] I want to know how to make string fomat

查看:79
本文介绍了我想知道如何制作弦枕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将字符串和ID的整数值连接起来.

I want to join string and Integer value for ID.

Dim DatePart As String = DateTime.Now.ToString("yyyy/MM/dd")
    Dim result As String
   DatePart = DatePart.Replace("/", "")




``所以这样的最终结果

2012041100001
2012041100002
|
|
|
|
|
2012041100020
2012041100200

因此,请帮助我:-)




''So the final result like this

2012041100001
2012041100002
|
|
|
|
|
2012041100020
2012041100200

So help me plz :-)

推荐答案

DateTime date = DateTime.Now;
int integer = 1;
string whatever = date.ToString("yyyyMMdd") + integer .ToString("d5");


应该做您想做的事,而无需不必要的替换.如果字符串要大于5位数字,则整数将超出格式,但仍然存在此问题.


Should do what you want, without the unecessary replace. The integer to string will go out of the format if it is longer than 5 digits, but you have this problem anyway.


DateTime date = DateTime.Now;
string whatever = date.ToString("yyyyMMdd") + iCount.ToString("d5");



iCount将一一递增......



iCount will Increment one by one ......



试试这个
Hi,
try this
Dim str As String = Date.now.ToString("yyyy/MM/dd")
Dim sb As New System.Text.StringBuilder

For Each ch As Char In str
    If Char.IsLetterOrDigit(ch) OrElse ch = " "c Then
        sb.Append(ch)
    End If
Next

MessageBox.Show(sb.ToString())


这篇关于我想知道如何制作弦枕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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