How to remove escape sequences from stream

前端 未结 5 1407
后悔当初
后悔当初 2021-01-14 15:48

is there an quick way to find(and remove) all escape sequences from a Stream/String??

5条回答
  •  伪装坚强ぢ
    2021-01-14 16:00

    Hope bellow syntax will be help full for you

    string inputString = @"hello world]\ ";
    
    StringBuilder sb = new StringBuilder();
    string[] parts = inputString.Split(new char[] { ' ', '\n', '\t', '\r', '\f', '\v','\\' }, StringSplitOptions.RemoveEmptyEntries);
    int size = parts.Length;
    for (int i = 0; i < size; i++)
        sb.AppendFormat("{0} ", parts[i]);
    

提交回复
热议问题