Java取出String字符串括号中的内容

Java取出String字符串括号中的内容,第1张

Java取出String字符串括号中的内容
package com.cnic.flink.etl.test;

import java.util.HashMap;
import java.util.Map;

public class Map2Bean {
    public static void main(String[] args) {
        String str = "[tid:2656,Q:W183CWbcBewrSgccJOdw] ";
        //String substring = str.substring(0, 10);
        //System.out.println(substring);
        //String sub001 = str.substring(0 ,10);
        //System.out.println(sub001);
        //int i = str.indexOf("[", "]");
        String substring = str.substring(str.indexOf("[")+1, str.indexOf("]"));
        System.out.println(substring);

        HashMap map = new HashMap();

    }
}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5717670.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-18

发表评论

登录后才能评论

评论列表(0条)

保存