Get string from between two characters

前端 未结 7 1253
情歌与酒
情歌与酒 2021-01-27 04:28

I need to get string from between two characters. I have this

S= \"10:21:35 |Manipulation       |Mémoire centrale   |MAJ Registre mémoire\"

a

7条回答
  •  没有蜡笔的小新
    2021-01-27 04:50

    Like in other answers I suggest you using split() method to separate your string but remeber to use trim if you won't have spaces after parts, like this:

    S= "10:21:35 |Manipulation       |Mémoire centrale   |MAJ Registre mémoire"    
    String splitted[] = S.split("\\|");
    String a = splitted[0].trim();
    String b = splitted[1].trim();
    ...
    

提交回复
热议问题