Skip to content
Advertisement

Tag: character

Doubling one letter with each new occurence

so I have task to double number of letter “a” every time it occurs in a string. For example sentence “a cat walked on the road” , at the end must be “aa caaaat waaaaaaaalked on the roaaaaaaaaaaaaaaaa” . I had something like this on my mind but it doubles every charachter, not only “a”. Answer You need to check

Replacing string for only one time in Java? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question Saying that there are String A = “aabbccdd” and String B = “abcd”, is there any way to remove the matching characters of String B

How to print sequence of characters according to the number next to it?

Input: a2b4c3 Output: aabbbbccc Here is my code………which has wrong output: Whats wrong in this code, I didn’t get the output as expected My output is: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccc Need corrections or code in java Answer Hi Here your answer. Or import java.lang.*; import java.util.ArrayList;

Difference between 0x0A and 0x0D

I was studying about bluetooth and I was trying to write the code to keep listening to the input stream while connected and i came across this following code snippet: Can someone explain what is the difference between 0x0A and 0x0D. And also give a brief explanation about this code. Kindly share your views. Answer The values starting 0x are

How to determine if a String has non-alphanumeric characters?

I need a method that can tell me if a String has non alphanumeric characters. For example if the String is “abcdef?” or “abcdefà”, the method must return true. Answer Using Apache Commons Lang: Alternativly iterate over String’s characters and check with: You’ve still one problem left: Your example string “abcdefà” is alphanumeric, since à is a letter. But I

Java – Forward Slash Escape Character

Can anybody tell me how I use a forward slash escape character in Java. I know backward slash is but I’ve tried / and / / with no luck! Here is my code:- Thanks in advance! Answer You don’t need to escape forward slashes either in Java as a language or in regular expressions. Also note that

Advertisement