How to find out the adjacent word pairs from a string in java? -


i have string good , want find out word pairs string such oo , if string success out put should cc ss without using string's built in functions in java.
possible?

without any built-in method - no. 1 or 2 - can

char previous = 0; char[] chars = str.tochararray(); (int = 0; < chars.length(); i++) {    if (chars[i] == previous) {        system.out.println(previous + "" + previous);    }    previous = chars[i]; } 

i prefer i < str.length() , str.charat(i), uses more string methods.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -