Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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);
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #java #insert #char #string #index
ADD COMMENT
Topic
Name
7+9 =