Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

C#, Split a string in half

  • 19-06-2012 10:11PM
    #1
    Registered Users, Registered Users 2 Posts: 7,544 ✭✭✭


    I have a string which can be of any length and will have no unique characters.

    I want to split this in half and store the sections in two separate variables.

    Any ideas?


Comments

  • Registered Users, Registered Users 2 Posts: 2,062 ✭✭✭Colonel Panic


    I'm sure you could work something out with string.Length and string.SubString...


  • Registered Users, Registered Users 2 Posts: 7,544 ✭✭✭BrokenArrows


    I'm sure you could work something out with string.Length and string.SubString...


    Bingo. Thanks.


  • Registered Users, Registered Users 2 Posts: 934 ✭✭✭moycullen14


    I have a string which can be of any length and will have no unique characters.

    I want to split this in half and store the sections in two separate variables.

    Any ideas?

    string /= 2; :)


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Wow, just wow. You actually asked how to do this instead of trying to work it out.


This discussion has been closed.
Advertisement