splitting strings

Discussion in 'ASP .Net' started by rodchar, Nov 29, 2007.

  1. rodchar

    rodchar Guest

    hey all,
    i have the following string value:

    xx__field_name__0__0

    is it possible to split the string using the double underscores?

    thanks,
    rodchar
     
    rodchar, Nov 29, 2007
    #1
    1. Advertising

  2. arrVal = "xx__field_name__0__0".split("__") or something of this nature
    should work.

    Regards,

    Trevor Benedict
    MCSD


    "rodchar" <> wrote in message
    news:...
    > hey all,
    > i have the following string value:
    >
    > xx__field_name__0__0
    >
    > is it possible to split the string using the double underscores?
    >
    > thanks,
    > rodchar
     
    Trevor Benedict, Nov 29, 2007
    #2
    1. Advertising

  3. Hi There,

    Of course you can, two ways from top of my head:

    string str = "xx__field_name__0__0";
    string[] result1 = str.Split(
    new string[] { "__" }, StringSplitOptions.RemoveEmptyEntries);

    string[] result2 = System.Text.RegularExpressions.Regex.Split(str, "__");

    Hope this helps
    --
    Milosz


    "rodchar" wrote:

    > hey all,
    > i have the following string value:
    >
    > xx__field_name__0__0
    >
    > is it possible to split the string using the double underscores?
    >
    > thanks,
    > rodchar
     
    Milosz Skalecki [MCAD], Nov 29, 2007
    #3
  4. rodchar

    rodchar Guest

    thanks everyone for the quick response this helped.
    rod.

    "rodchar" wrote:

    > hey all,
    > i have the following string value:
    >
    > xx__field_name__0__0
    >
    > is it possible to split the string using the double underscores?
    >
    > thanks,
    > rodchar
     
    rodchar, Nov 29, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. leni
    Replies:
    3
    Views:
    931
    Dag Sunde
    Aug 7, 2005
  2. John Ericson
    Replies:
    0
    Views:
    427
    John Ericson
    Jul 19, 2003
  3. Mark
    Replies:
    0
    Views:
    442
  4. John Dibling
    Replies:
    0
    Views:
    417
    John Dibling
    Jul 19, 2003
  5. Ben

    Strings, Strings and Damned Strings

    Ben, Jun 22, 2006, in forum: C Programming
    Replies:
    14
    Views:
    767
    Malcolm
    Jun 24, 2006
Loading...

Share This Page