Length of string WITHOUT spaces (C#)
问题 Quick little question... I need to count the length of a string, but WITHOUT the spaces inside of it. E.g. for a string like "I am Bob", string.Length would return 8 (6 letters + 2 spaces). I need a method, or something, to give me the length (or number of) just the letters (6 in the case of "I am Bob") I have tried the following s.Replace (" ", ""); s.Replace (" ", null); s.Replace (" ", string.empty); to try and get "IamBob", which I did, but it didn't solve my problem because it still