How can I show a separate string array and its values?

0

I am working with mulestudio and I have a string that is large and I made an arrangement of it since when I call the string to print it or it gives me errors or it shows me all messy and what I want is to show each variable with its value separately , but I have no idea how I can do to show each value of the string separately with its response.

This is the String.

DATOS: 
Central: xxx, 
IP dslam: 11.111.11.111, 
IP bras: 111.11.1.111, 
COID: 1111, 
Rack: 11, 
SubRack: 11, 
Slot_dslam: 11, 
Port_dslam: 1, 
Dslam_provider: 1111X, 
Community: xxxxxxx, 
Virtual_rack: 11 , 
Virtual_subrack: 11, 
SVLAN: 111, 
CVLAN: 1111, 
Erxslot: 1, 
Erxcard: 1, 
Erxport: 1,  
Provider_BRAS: XXXX, 
Model_BRAS:XX11, 
Nombre_BRAS:xxx-xxx-11, 
DSLAMPORTID: 111111 
Datos:, xxxxx, 1111, 111, XXXX, xxxx
physical (xxxxx)= 1, 
admin (xxxx)= 1, 
Profile_XXX= 11 --->Invalid Profile 
Velocidades(xxxx): 
DOWN= 111,
 UP = 111 

What I want in theory is to make an arrangement that returns each variable so to speak with its value.

Example:

Central xxx
IP dslam 11.111.11.111
IP bras 111.11.1.111

And so with each one removing the ":" and the "," to make it look cleaner.

I have something like that (the object variable has the string array)

String[] objeto = this.readHTMLData(boss_RP);
             for (int i = 0 ; i < objeto.length ; i++) {

                 LoggerClass.LogDebugSevice(response.infogenerico.getServiceInfo(), i+" "+objeto[i]);   
                }

private String[] readHTMLData(String objeto) {
        String delimitadores= "\s*,\s*";  
        String[] arrayObjetos = objeto.split(delimitadores); 


    return arrayObjetos;  

This works for me but it prints the variables without the values and with the ":". (obviate what the boss_RP brings).

    
asked by Miguel C. 06.06.2017 в 16:39
source

1 answer

1

If you make a split of your string containing the values using the "," tab, you generate an array:

 String[] valores = datos.split(",");

later it replaces ":" by empty string and you will get the variable separated by its value:

 for (String s : valores){
      s = s.replace(":", "");
      System.out.println(s);
  }

in this way you would get:

Central xxx 
IP dslam 11.111.11.111 
IP bras 111.11.1.111 
COID 1111 
...
...
...

You can see this example online

    
answered by 06.06.2017 / 16:52
source