首页 > 解决方案 > Java how to remove fields into a String value?

问题描述

Good afternoon, I would like to know what is the easiest function that would fix my problem.

InputStream in = socket.getInputStream();
            byte[] buffer = new byte[2048];
            int received = in.read(buffer, 0, buffer.length);

            messageFromServer = new String(buffer, 0, received); //     F108102200000002E00002940001...       

the String MessageFromServer receives a value from the server via a socket, and I would like to treat that message excluding the first 2 characters of it. In addition to, for example, excluding the string in the field (33 to 40) (EXAMPLE). I saw the replace function but I don't know if it is the best one to use, could someone answer me by passing an example? Thank you.

标签: javaandroidstringsubstringiso

解决方案


推荐阅读