daily pastebin goal
96%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.lang.StringBuilder;
  2.  
  3. public class Program {
  4.     public static void main(String[] args) {
  5.  
  6.         int idSolicitud = 300;
  7.         double numCifra = 3.14;
  8.         char usuarioBD = 'A';
  9.  
  10.         // Creas un nuevo StringBuilder.
  11.         StringBuilder builder = new StringBuilder();
  12.  
  13.         // Agregas los String o Variables al builder con append
  14.         builder.append("Solicitud [idSolicitud="); //String
  15.         builder.append(idSolicitud); // Var
  16.         builder.append(", numCifra=");
  17.         builder.append(numCifra);
  18.         builder.append(", usuarioBD=");
  19.         builder.append(usuarioBD);
  20.         builder.append("]");
  21.  
  22.         // Conviertes a string
  23.         String result = builder.toString();
  24.  
  25.         // Print result.
  26.         System.out.println(result);
  27.     }
  28. }
  29.    
  30. // Inserta un substring en la posiciĆ³n 2.
  31. builder.insert(2, "xyz");
  32.    
  33. // Intenta encontrar la posiciĆ³n del substring.
  34. int result = builder.indexOf("bc");
  35.    
  36. // Borra los characteres desde el index 2 hasta el index 5.
  37. builder.delete(2, 5);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top