Re: Var type

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Maarten,

If all you are doing is splitting on the "/", then a regex is overkill
here. Basically, you should use the Split method on the string class, like
so:

string[] s = strvalues.Split(new char[1]{'/'});

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"Maarten" <gurkjaan@xxxxxxxxxxx> wrote in message
news:43906830$0$31774$ba620e4c@xxxxxxxxxxxxxxxxx
> HI,
>
> i want to split a variable containing this -----> prog/2
> i want to split on the /
>
> the value is entered in a datagrid, but when i declare the collumn fir
> stringinputs
> i get an error the the inputformat is wrong.
> Regex r = new Regex("(/)");
>
> string[] s = r.Split(strvalues);
>
> MessageBox.Show(s[0]+s[1]);
>
> What is wrong here ?
>
> Regards Maarten
>
>


.



Relevant Pages

  • Re: Return ID from URL
    ... I would recommend passing the URL to the Split method on the string class, passing the "/" character to split the directories. ... From the origina post I read that there are multiple formats, some of which don't have the number as a directory, some of which have. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: reading a text file into an array
    ... In the String class, you have a Split method returns a String table ... //Read the number of lines and put them in the array ... //This will write the 1st line into the console ...
    (microsoft.public.pocketpc.developer)
  • Re: Var type
    ... Basically, you should use the Split method on the string class, ... >> i get an error the the inputformat is wrong. ... Prev by Date: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Convert string to a string array
    ... > You would create a new array using the Split method of the string class. ... >> MyStringArray so I could access them as ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Replace various regex
    ... a series of regex, ... canht_ft", CANHT, s) ... But this involves me passing the entire string. ... The .split method, incidentally, accepts a maxcount argument so ...
    (comp.lang.python)