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

前端 未结 5 563
离开以前
离开以前 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:10

    This will be more robust if you use

    var parts = string.Split('=')
    

    Who knows if someone decides to put a space before or after the equal sign? That would break your existing solution because it would not find "part =XXX". With split you get the parts on either side.

提交回复
热议问题