Array filter repeat character

zhaozj2021-02-16  74

There is a string number {"1", "1", "2", "3", "4", "5", "6", "6", "7", "8"} hope Filters the repeated characters, becomes: {"1", "2", "3", "4", "5", "6", "7", "8"}

------------- Public static int [] removedup (int [] mydata) {if (myData.length> 0) {Array.Sort (MyData); int size = 1; // At Least 1 for (int i = 1; i

IF (MyData [i]! = mydata [i-1])

SIZE ;

int [] mytempdata = new int =

INT j = 0;

MyTempdata [J ] = mydata [0];

For (int i = 1; i

IF (MyData [i]! = mydata [i-1])

MyTempdata [J ] = MyData [i];

Return mytempdata;

}

Return mydata;

}

// Used to remove the repeated number, modify it

转载请注明原文地址:https://www.9cbs.com/read-12288.html

New Post(0)