首页 > 解决方案 > How to properly manage what has been read from a .txt

问题描述

I've been currently assigned to read from a .txt, and make a structure with what I've read. This is an example of what I should read:

Name1$Surname1$Programming&5.0#Mathematics&6.5#Algebra&7.2#History&6.7#Biology&6.9

I have no problems whatsoever when it comes to read the first two strings, however, from that point on i don't know how to manage, in order to properly split it and make new objects with them.

Any tips/ suggestions on how to do it pls?

标签: javasplit

解决方案


奇怪的结构。

  1. 在“$”处拆分
  2. 该拆分的第一个元素是姓名,其次是姓氏。
  3. 在“#”处拆分第三个元素。
  4. 在“&”处再次拆分第 3 步结果的每个元素以获得课程和成绩。

请参阅此处如何拆分字符串。


推荐阅读