Answers for "append char to char array java"

2

java put a char array into a string

char[] arr = { 'p'," ",'q', 'r', 's' };
      String str = String.valueOf(arr);
      System.out.println(str);//"p qrs"
Posted by: Guest on March-20-2020
1

java insert char in string at index

public String addChar(String str, char ch, int position) {
    return str.substring(0, position) + ch + str.substring(position);
}
Posted by: Guest on December-19-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language