Javatpoint Logo

Replace a string without using any String functions in java

By: madhu2*** On: Wed Feb 15 14:57:16 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
Eg: javatpoint
replace "a" with "help"
output: jhelpvhelptpoint
without using any string functions not even "length","charAt"
Please help
Thank you
Up0Down

 
Image Created0Down

By: [email protected] On: Wed Feb 15 18:37:58 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No
 

import java.util.regex.Pattern;


public class ReplaceCharacter {

public static void main(String[] args) {

String str="javatpoint";


System.out.println(Pattern.compile("a").matcher(str).replaceAll("help"));


}

}
Image Created0Down

By: [email protected] On: Fri Feb 17 14:39:49 IST 2017 Question Reputation0 Answer Reputation0 Belt Series Points0 0User Image
Are You Satisfied :0Yes0No