How to get substring from string in c#?

前端 未结 7 1557
夕颜
夕颜 2020-12-16 12:09

I have a large string and its stored in a string variable str. And i want to get a substring from that in c#? Suppose the string is : \" Retrieves a substring from thi

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 12:35

    it's easy to rewrite this code in C#...

    This method works if your value it's between 2 substrings !

    for example:

    stringContent = "[myName]Alex[myName][color]red[color][etc]etc[etc]"
    

    calls should be:

    myNameValue = SplitStringByASubstring(stringContent , "[myName]")
    
    colorValue = SplitStringByASubstring(stringContent , "[color]")
    
    etcValue = SplitStringByASubstring(stringContent , "[etc]")
    

提交回复
热议问题