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: compiler 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

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -