Monday, January 9, 2023

String Builder

  String input = "TestInput";


    StringBuilder b = new StringBuilder();
    b.append(input.charAt(0));
    for (int i = 1; i < input.length(); i++) {
        b.append("*").append(input.charAt(i));
    }
    System.out.println(b);
}

gives:

T*e*s*t*I*n*p*u*t

No comments:

Post a Comment

CORBA Java Tutorial using Netbeans and Java 8.

CORBA-Example A simple CORBA implementation using Java Echo.idl module EchoApp{ interface Echo{ string echoString(); }; }; ...