Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

C#, Split a string in half

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


    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,065 ✭✭✭Colonel Panic


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


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


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


    Bingo. Thanks.


  • Registered Users, Registered Users 2 Posts: 968 ✭✭✭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
Advertisement