How to implement the function Remove() to remove substring from specified index in Java

1 Answer

0 votes
public class MyClass {
    public static String Remove(String string, int start) {
        return string.substring(0, start);
    }
    public static void main(String args[]) {
        String str = "java c c++ rust";
       
        str = Remove(str, 6);
 
        System.out.println(str);
    }
}
 
 
 
 
/*
run:
 
java c
 
*/

 



answered Aug 28, 2023 by avibootz
edited Aug 28, 2023 by avibootz

Related questions

...