Skip to content

Instantly share code, notes, and snippets.

@youngjinmo
Created September 17, 2019 15:12
Show Gist options
  • Save youngjinmo/bcb44efe4e4bd585334008ddccc2faf3 to your computer and use it in GitHub Desktop.
Save youngjinmo/bcb44efe4e4bd585334008ddccc2faf3 to your computer and use it in GitHub Desktop.
문자열 알파벳 순서대로 정렬
import java.util.Arrays;
public class quizTest_03 {
public static String orderByAscii(String str){
String[] temp = str.split("");
Arrays.sort(temp);
String change = "";
for (int i = 0; i < temp.length; i++) {
change += temp[i];
}
return change;
}
public static void main(String[] args) {
String data = "Hello World";
System.out.println(orderByAscii(data));
// HWdellloor
System.out.println(orderByAscii(data).length());
// 11
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment