What do you want to save?
Add Code snippet
New code examples
-
Java 2021-11-15 04:42:26
codingbat java string 2 xyzthere
public boolean xyzThere(String str) { int flag=0; for(int i=0;i<str.length()-2;i++){ if (str.substring(i,i+2).compareTo("xy")==0 & str.substring(i+1,i+3).compareTo("yz")==0){ if ((i-1)>=0){ if (str.charA... Add solution -
C++ 2021-11-08 05:35:24
implementing split function in c++
void tokenize(string &str, char delim, vector<string> &out) { size_t start; size_t end = 0; while ((start = str.find_first_not_of(delim, end)) != string::npos) { end = str.find(delim, start); out.push_back(str.substr(start, end - st... Add solution -
Java 2021-11-07 12:13:09
java count frequency of characters in a string
+++METHOD WITH NONDUP+++ public static String FrequencyOfChars(String str) { String nonDup = ""; for(int i=0; i < str.length(); i++) if(!nonDup.contains(""+str.charAt(i))) nonDup+= ""+str.charAt(i); String expectedRe... Add solution -
Java 2021-11-07 11:38:14
java string replace character at position
String str = in.nextLine(); //Original String char cr = in.next().charAt(0); // character to replace int index = in.nextInt(); // Index where replaced str = str.substring(0, index) + cr + str.substring(index + 1);// modified string Add solution