java - Elements of a split string array can't be used as function inputs? -


here code:

// bug - works. string[] lst = {"desk", "pencil"}; string lst0 = lst[0]; system.out.println("path: " + lst[0]); system.out.println("result: " + root.getdirectory(lst0).getfilename());  // bug - doesn't work. string[] ef = "desk/pencil".split("/"); string ef1 = ef[0]; system.out.println("path: " + ef1); system.out.println("result (without getfilename): " + root.getdirectory(ef1)); 

but in second case, function isn't called properly, ef[0] seems considered differently lst[0] compiler despite both being strings. assume becaue lst array resulted list splitting. there way fix/work around this?


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -