Java — Method Chaining in String, StringBuffer & StringBuilder | Code Factory

String s = new String("    Code Factory  ").replace("o", "O").trim();
System.out.println(s);
StringBuffer sb = new StringBuffer("Code Factory").replace(4, 5, "-").append(123);
System.out.println(sb);
StringBuilder sbl = new StringBuilder("Code Factory").replace(4, 6, "-").delete(10, 11);
System.out.println(sbl);
COde FactOry
Code-Factory123
Code-actor

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Convert Python Code to .exe File? | Convert .py File to .exe File | By Ali Jakhar

Creator Weekly Update: November 7, 2021

Cucumber — Features and Scenario | Code Factory

Player Progress Part 4

Quickly Run NodeJS Demos in Vanilla Windows Sandbox featuring Scoop package manager

Deploying a Deep Learning pipeline with Docker on AWS

Oh shit! PHP extension is not working!

Nothing seems to work!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code Factory

Code Factory

More from Medium

What are Algorithms?

Are you still didn’t start using Version Control for Data?

What is Code Review and the Key Tips and Tricks

Five Golden Rules to Achieve Agile Software Localization