W
W
Wana12022-01-05 17:36:32
Java
Wana1, 2022-01-05 17:36:32

How to parse java text from a variable?

spoiler
bci=0076864; _statid=abce657e-3747-40e4-96ab-423423f20; DCAPS=dpr%5E2%7Cvw%5E171%7Csw%5E360%7C; tmr_reqNum=0; tmr_lvid=464f1484376652ed2274da99401c34; tmr_lvidTS=164137638422423; community-lang=ru; _userIds=""; _sAuth351542340634=""; sptfdt=0; JSESSIONID=b5173342c628342342a9aa0453eb456456731b08906664b691d2.47d78759; AUTHCODE=6YkLNOb4356Db4234CZbwfm-lPwML87lxKKxpF38djuDR0KItzA564E6qJFLWH5G2t85CQU8d5u2QWQH-LwnSpFQ6H1uWp88Zcp3qY-qtG1UII7xVW565tjwPmuUmYRucbYhr-dl7s9kMZqgX_4; __seed=2124565890; SERVERID=4f35065655ad98672b74ee17060a4564|YdWqh; tmr_detect=0%7C16413927456480
from this text you need to get JSESSIONID = and put it in a variable can tell me how to do it

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2022-01-05
@xez

By analogy: https://qna.habr.com/q/1097286

S
Sergey Vodakov, 2022-01-05
@WaterSmith

You can use a regular expression, something like: JSESSIONID=(.*?);
You can stupidly find the occurrence of "JSESSIONID =", then take a substring, and find the first occurrence of ";" in it. - the substring between them will be necessary.
And you can split the string into an array, by ";", then split each element of the array into two parts, before "=" and after, and add it to a hashmap, thus we will be able to manipulate data through key-value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question