Does C# have a String Tokenizer like Java's?

前端 未结 11 1505
日久生厌
日久生厌 2020-12-01 11:31

I\'m doing simple string input parsing and I am in need of a string tokenizer. I am new to C# but have programmed Java, and it seems natural that C# should have a string tok

11条回答
  •  天命终不由人
    2020-12-01 12:29

    If you are using C# 3.5 you could write an extension method to System.String that does the splitting you need. You then can then use syntax:

    string.SplitByMyTokens();
    

    More info and a useful example from MS here http://msdn.microsoft.com/en-us/library/bb383977.aspx

提交回复
热议问题