Skip to content

Commit

Permalink
providing meaningful names
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Lu-none committed Dec 9, 2023
1 parent d4388a5 commit 8f5b5b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/src/connector/course_connector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ class CourseConnector {
// (ex: 學號:110310144  姓名:xxx  班級:電機三甲    112 學年度 第 1 學期 上課時間表)
// so the RegExp is used to filter out only the number parts
final titleString = nodes[0].text;
final RegExp regex = RegExp(r'\b\d+\b');
final Iterable<RegExpMatch> matches = regex.allMatches(titleString);
final List<String> numbers = matches.map((match) => match.group(0)).toList();
final RegExp numberFilter = RegExp(r'\b\d+\b');
final Iterable<RegExpMatch> numberMatches = numberFilter.allMatches(titleString);
// the "numbers" should consist of three numerical values
// ex: [110310144, 112, 1]
final List<String> numbers = numberMatches.map((match) => match.group(0)).toList();
semester.year = numbers[1];
semester.semester = numbers[2];

Expand Down

0 comments on commit 8f5b5b4

Please sign in to comment.