Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Split String not working

Discussion in 'Visual Scripting' started by millefoliumink, Sep 22, 2021.

  1. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    I have a list of strings that I choose a random from and split using the '|' character, but when testing using the Debug.Log it returns the strings split by a white space ' '. I've tried replacing '|' with other characters but it only ever splits by white space ' '.



    I'm transcribing some old code into Visual Code and the original line was as follows:
    Code (CSharp):
    1. string[] strPieces= thisStr.Split('|');
     
  2. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139

    Switching it out to this works but seems like a turgid way of doing things..