如何用模式生成字符串? [英] How to generate strings with pattern?

查看:74
本文介绍了如何用模式生成字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我的网站有一个要求会自动生成字符串,如果添加另一条记录则会自动增加5。例如,如果用户将从下拉列表中选择代码,它将自动生成子项代码,如下所示:



PPY-05 ---> ; PPY-CC-05

---> PPY-CC-10

---> PPY-CC-15



顺便说一句,第一个代码(PPY-05)来自名为milestone_code的数据库。因此,如果用户想要创建该milestone_code的子项,则它将是PPY-CC-05,PPY-CC-10等。然后,此子项将保存到名为check_code的数据库中。此check_code还将包含子项。如果用户从下拉列表中选择PPY-CC-05,网站将自动生成如下所示的代码:



PPY-CC-05 - - > PPY-CC-AC-05

---> PPY-CC-AC-10



所有商品代码都应自动添加5.



有人能帮帮我吗?希望你理解我的问题:)

Hi guys!
I have a requirement in my website that would automatically generate strings and automatically increase by 5 if another record will be added. For example,if the user will select a code from a drop down list, it will automatically generate sub items code as shown below:

PPY-05 ---> PPY-CC-05
---> PPY-CC-10
---> PPY-CC-15

By the way, the first code (PPY-05) is taken from the database named milestone_code. So if the user would like to create sub items of that milestone_code, it will be PPY-CC-05, PPY-CC-10 and so on. Then this sub items will be saved into the database named check_code. This check_code will also have sub items. if the user will choose PPY-CC-05 from a drop down list the website will automatically generate their code like this one below:

PPY-CC-05 ---> PPY-CC-AC-05
---> PPY-CC-AC-10

all of the item codes should be added automatically by 5.

Can somebody help me? Hope you understand my problem :)

推荐答案

你好,



你的要求听起来很有趣,但我是不确定你在哪里使用StringBuilder

,你可以很容易地实现这一点,保持数字部分分开,因为你想为每个新的选择增加它,并保持最后的asign数和代码的历史记录不同的变量。



我不确定你是如何使用数据库的,但我希望你能轻松完成。但仍然供你参考,请看这个链接



http://msdn.microsoft.com/en-us/library/2839d5h5(v = vs.110).aspx [ ^ ]





我希望它能解决你的问题......请评论一下,如果它适用于你:)
Hi,

Your requirement sounds interesting, but i am not sure where are you stuck
using StringBuilder , you can easily achieve this , keep the number part separate as you want to increase it for every new selection , and maintain a history of last asign number and code in different variables.

I am not sure how you are using the Database , but i hope you can do it easily. but still for your reference please see this link

http://msdn.microsoft.com/en-us/library/2839d5h5(v=vs.110).aspx[^]


I hope it solves your problem... please comment if it works for you :)


这篇关于如何用模式生成字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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