Search
 
SCRIPT & CODE EXAMPLE
 

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);
}
Comment

add character to a string java

public class JavaHungry {
    public static void main(String args[]) {
      char ch = 'J';
      String str = "avaHungry";
      //Adding character at the beginning
      str = ch + str; 
      System.out.println(str); 
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: set ImageView size programmatically android 
Java :: awk print second 
Java :: java opts 
Java :: how to find a word in string in java 
Java :: convert char to string in java 
Java :: How to generate all possible IP addresses based on a given set of digits, in Java? 
Java :: running sum of 1d array leetcode 
Java :: check key is pressed java 
Java :: java download image file 
Java :: How to determine if a graph contains a cycle, in Java? 
Java :: print java 
Java :: Java Converting int to double 
Java :: java break multiple loops 
Java :: get frequency of letters java 
Java :: java read next line 
Java :: android studio alert dialog box 
Java :: viewpager2 dependency 
Java :: fill two dimensional array columns by columns java 
Java :: how to get the max value of an array java 
Java :: template competitive programming java 
Java :: android-edittext allow only characters and numbers 
Java :: matrice java 
Java :: test a javafx project 
Java :: how to use sql file in java 
Java :: java throw keyword 
Java :: how to find the prime numbers in java 
Java :: java logger with different colors 
Java :: hide icon android studio 
Java :: one line if statement java 
Java :: convert a int to string in java 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =