Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

quitar letras repetidas de una palabra en java

public static void removeDuplicates(char[] str) {
  if (str == null) return;
  int len = str.length;
  if (len < 2) return;
  int tail = 1;
  for (int i = 1; i < len; ++i) {
    int j;
    for (j = 0; j < tail; ++j) {
      if (str[i] == str[j]) break;
    }
    if (j == tail) {
      str[tail] = str[i];
      ++tail;
    }
  }
  str[tail] = 0;
}
Source by www.iteramos.com #
 
PREVIOUS NEXT
Tagged: #quitar #letras #repetidas #de #una #palabra #en #java
ADD COMMENT
Topic
Name
4+9 =