Home java How to paint?

How to paint?

Author

Date

Category

is available (located inside String ABC):

[["Why a cat dog?", "Why Cat Is Dog?", "Pochemu Koshka Sobaku?" , ""]] ,, "EN" ,, [["Why", [4], 1,0,1000,0,1,0], ["Cat", [5], 1,0,869,1, 2.0], ["Dog?", [6], 1,0,505,2,4,0]], [["Why", 4, [["Why" 1000,1,0], [" Why, "0,1,0], [" Why "0,1,0], [" What ", 0,1,0]], [[0,3]]," Why Cat Is Dog? "], [" Cat IS ", 5, [[" Cat ", 869,1,0], [" cats ", 130,1,0], [" cats ", 0,1,0], [" Cat ", 0,1,0], [" cats ", 0,1,0]], [[4,10]]," "], [" Dog? ", 6, [[" Dog? ", 505,1,0]], [[11,15]], ""]] ,,, [["en"]], 64]

Required: get the first part of the text (in this case – why a cat dog? )

Question: How?


Answer 1

abc.delete (0, 3);
abc.delete (Texto.Indexof ("\" "), -1);

Answer 2

You are trying to steal the JSON format. For this you need to use, understandable, JSON-parser.

Look here: json.org/java .

You can, of course, try not to use a parser, hoping that the string structure will never change. (For example, that there will never be any spaces between square brackets.) For such a case you can do both differently, but the “dishonest” solution will be more fragile, poor in support and expansion, and exposed to different kinds of errors.


Answer 3

string [] tokens = abc.split ("\");
STRING RESULT = TOKENS [1];

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions