Split a string into two Strings?

I have two strings :

public var string1 = "";
public var string2 = "";

I want to make it so if string1 exceeds 100 characters then the rest of the string is removed and added to string2 starting from the last space in string1. (to avoid breaking apart words)

I have absolutly no idea how this would be done except for that I would start with :

if(string1.Length > 100){

Any help would be great!

if(string1.Length > 100)
string2 = string1.Substring(100);
string1 = string1.Substring(0, 100);

You didn’t specify if space has to be before/after, so here is a method for after:

private static void SplitString (string source, out string a, out string b, int length)
    if (source.Length < length)
        a = source;
        b = "";

    int spaceIndex = source.IndexOf (' ', length);

    if (spaceIndex != -1)
        a = source.Substring (0, spaceIndex);
        b = source.Substring (spaceIndex + 1);

    a = source.Substring (0, length);
    b = source.Substring (length);

You can use it with:

string a, b;
SplitString ("Hello World, how are you today, good I hope, excellent, let us go on!", out a, out b, 18);