-5

my question is how to removing character

i want te remove

[ "Informasi Seputar Ijazah dan SKHUN SMA"]

become

Informasi Seputar Ijazah dan SKHUN SMA

i've tried

String link=object.get("url").toString();
String link2=(link.substring(1, link.length()-1));

but the result is only

 (space)"Informasi Seputar Ijazah dan SKHUN SMA"

any solution guys? thanks before...

beboy
  • 105
  • 1
  • 12
  • try `String link2=(link.substring(2, link.length()-1));` if you have a space after `[` character in your original string. – Kaushal28 Jul 01 '16 at 08:26
  • 3
    If your question is not so important, then try different options than asking it. Like: doing some prior research. – GhostCat Jul 01 '16 at 08:29
  • its can remove (space) mate, but it cant remove " " , i want remove " " too hehe – beboy Jul 01 '16 at 08:30
  • hehe maybe for some java master its not so important, but its very important for me :) sorry if my words is wrong.. – beboy Jul 01 '16 at 08:32
  • You could try something like `String link=object.get("url").toString();` `String link2 = link.replaceAll("(\\[|\\]|\")", "").trim();` – Rex Wagenius Jul 01 '16 at 08:44

1 Answers1

0

Just trim more characters at the start of the string :

String link=object.get("url").toString();
String link2=(link.substring(2, link.length()-1));
Olivier Croisier
  • 6,139
  • 25
  • 34
  • logically it can, but its always says error stack trace every i do more trim here i trim again : String link2=(link.substring(2, link.length()-1)); String link3=(link2.substring(1,link2.length()-1)); the error says stack trace every i trim more than link2 mate – beboy Jul 01 '16 at 08:31