android - Extract array elements and create a String from them -


i have got array through vector addittion [1!,2!,3!,4!]

i have convert string

{1!2!3!4!} 

..can please tell me name of few methods can make it? all..

string getelement = null;              for(int j = 0;j<5;j++){              getelement = dynamicviewtagnames.elementat(j);               } 

i can elements of array this..then have convert string.

i'm not sure if understand question correctly, if want turn this:

[1!,2!,3!,4!]

into

{1!2!3!4!}

you can example make use of string.replace() or string.replaceall() method.

string str = "[1!,2!,3!,4!]"; str = str.replace("[", "{"); str = str.replace("]", "}"); str = str.replace(",", ""); 

if [1!,2!,3!,4!] vector containing strings showed above, using stringbuffer:

// letz assume vector has following content: [1!,2!,3!,4!] vector<string> dynamicviewtagnames = new vector<string>();   stringbuffer b = new stringbuffer();  b.append("{");  for(int = 0; < dynamicviewtagnames.size(); i++) {     b.append(dynamicviewtagnames.get(i)) }  b.append("}"); string mystring = b.tostring(); 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -