C# Substring Alternative - Return rest of line within string after character

前端 未结 5 613
离开以前
离开以前 2021-01-17 03:25

I have some code that reads a text file and sets it to a string. Each line of the text file contains separate data parameters that I a trying to extract. Here is an small ex

5条回答
  •  盖世英雄少女心
    2021-01-17 04:06

    You can use split, it can be easier to read:

    string value = partData.Split('=', 2)[1];
    

    Beware that can throw an exception if there's no '=' on the line.

提交回复
热议问题