warriors warriors - 1 year ago 89
C# Question

Generating folders using textboxes

Hello experts, I have to generate series of folders from a

into specified location.I am having two textboxes to specify the limit of folders(say 30 folders).The problem am facing is that the folder names that i will be providing are alpha-numeric(say 121cs3h101) .

How to set limit when i provide an alpha-numeric values?

(For example: i provide
, i need the series limit to be generated). I am working with visual studio 2013 in c# windows form application. Thanks in advance.

Answer Source

ok I will try to give you a lead.

To parse a string or find specific characters one can use RegEx.Match or a simler method called String.Split. In both cases you have to be aware how your string is structured and how it can vary. The limits of variation are very important.

If as you say the beginning is always"12cs3h" you can either split the string at the character 'h'.

string[] sa = s.Split('h');

Or you can even use the index of 'h' (since the length seems to be fixed) and take the rest of the string to get the numbers.

int index = s.IndexOf('h');

The rest is up to you, ... convert, enumerate and so on.

EDIT: There is a nice method that does the enumeration job for you: Enumerable.Range Good luck

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download