How to compare null character in java




















Please use ide. Load Comments. What's New. Most popular in C Programs. Most visited in Difference Between. We use cookies to ensure you have the best browsing experience on our website. Start Your Coding Journey Now! Login Register.

Change Language. Related Articles. Table of Contents. Improve Article. Save Article. Like Article. Last Updated : 06 Dec, This is a very accurate answer. This is a correct solution and should be the accepted answer.

Although this does not answer the OP, it's what I was looking for. The MOST correct answer is "it cannot be done". This is the nearest you can get. Character is, but char isn't. Show 1 more comment. You say you want to "replace a character without leaving a space". Apart from replace solution other two will replace just the first occurrence of the character and not all. Thomas Thomas 1 1 silver badge 7 7 bronze badges. Any similarity to some other character set or character encoding is irrelevant.

UTF is what Java uses. I was looking for this. Try it. Emeka Onwuliri Emeka Onwuliri 87 4 4 bronze badges. Assuming that in the string, say str, OP wants to replace all occurrences of a character, say 'x', with empty character '', then try using: str. John Hascall 8, 4 4 gold badges 47 47 silver badges 65 65 bronze badges.

That's not an empty character. It is a zero length character array. You can do something like this: mystring. KayV KayV Peter Lawrey Peter Lawrey k 73 73 gold badges silver badges bronze badges. What do you mean it not worked?

DO you mean it doesn't compile? You need to work out what your real requirement is and try to solve it a different way. Daria Yershova Daria Yershova 44 2 2 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.

Featured on Meta.



0コメント

  • 1000 / 1000