hi... i have a string array.examples i have first element like this; you-and-i. for each element in the array...i want to delete the '-'and change it with and '' character... this mean that the examples will be youandi.....how to do this???
Thank you for the input, Yosi Hendarsjah. It is useful information for us moderators who don't speak Indonesian/Malaysian. [ March 04, 2005: Message edited by: Marilyn de Queiroz ]
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Oct 28, 2004
hehe...yeah...sukahati means happy.... back to my question......
i have a string array.examples i have first element like this; you-and-i. for each element in the array...i want to delete the '-'and change it with and '' character... this mean that the examples will be youandi.....how to do this???
i want to delete all '-' in every element of that array....i try to to a looping, in every looping....the element involve....i use indexOf to get where the '-' is and then use deleteCharAt...like below cooding
StringBuffer cTest = new StringBuffer(outputPos[finaltest]); int tryElement; tryElement=(outputPos[finaltest]).indexOf("-"); cTest=cTest.deleteCharAt(tryElement);
but tryElement send a negetif value....how to solve this problem
Joined: Oct 02, 2003
In your code, when searching for substring "-", you searched in the String object. But when deleting, you used the StringBuffer object. So, after first deletion, the contents of the String object and the StringBuffer object are not the same anymore. And you may delete the wrong character. And if indexOf method returns negative value, it means there are no substring you are searching for in the String or StringBuffer object.
[ March 07, 2005: Message edited by: Yosi Hendarsjah ] [ March 07, 2005: Message edited by: Yosi Hendarsjah ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com