Search code examples
c#universe

c# convert string to array on char(253) deliminator


Not entirely sure the following code is going to help many people, but here goes

          try
        {
            uvConnect = UniObjects.OpenSession(serverId, sUser, sPass, sAcct, "uvcs");

            // Open Movie File
            UniFile uvFile = uvConnect.CreateUniFile("MOVIES");
            UniDynArray movieRec = uvFile.Read(txtMovieId.Text);

            string sMovieData = movieRec.StringValue;
            MessageBox.Show(sMovieData);
        }

sMovieData contains a single string of the entire record retrieve from MOVIES file, each field is deliminated by a char(253) character in the database I am using.

Is there a function/method/etc to convert the string to an array using char(253) as a value deliminator


Solution

  • Something like this should work:

    string[] fields = sMovieData.Split((char)253);