arrays - .Trim() Method not working? C# -
i'm looping through elements in string array find , remove vowels, yet removes 'o' first element.
what have:
string[] inst = new string[] { "cello", "guitar", "violin", "double bass", }; for(int x = 0; x < inst.length; x++) { console.writeline(inst[x].trim(new char[] { 'a', 'e', 'i', 'o', 'u' })); } output: 
that's expected behaviour. trim() removes specified characters begging , end of string:
the trim method removes current string leading , trailing white-space characters. each leading , trailing trim operation stops when non-white-space character encountered. example, if current string " abc xyz ", trim method returns "abc xyz".
http://msdn.microsoft.com/en-us/library/t97s7bs3(v=vs.110).aspx
Comments
Post a Comment