Source:
<code>public String getCourseStudentListAsCsv(String courseId, String googleId) throws EntityDoesNotExistException { HashMap<String, CourseDetailsBundle> courses = getCourseSummariesForInstructor(googleId); CourseDetailsBundle course = courses.get(courseId); boolean hasSection = hasIndicatedSections(courseId); String export = ""; export += "Course ID" + "," + Sanitizer.sanitizeForCsv(courseId) + Const.EOL + "Course Name" + "," + Sanitizer.sanitizeForCsv(course.course.name) + Const.EOL + Const.EOL + Const.EOL; if(hasSection){ export += "Section" + ","; } export += "Team" + "," + "First Name" + "," + "Last Name" + "," + "Status" + "," + "Email" + Const.EOL; for (SectionDetailsBundle section : course.sections) { for (TeamDetailsBundle team : section.teams) { for(StudentAttributes student : team.students){ String studentStatus = null; if(student.googleId == null || student.googleId.equals("")){ studentStatus = Const.STUDENT_COURSE_STATUS_YET_TO_JOIN; } else { studentStatus = Const.STUDENT_COURSE_STATUS_JOINED; } if(hasSection){ export += Sanitizer.sanitizeForCsv(section.name) + ","; } String[] splitName = student.name.split(" "); String firstName = ""; String lastName = ""; int lastNameIndex = splitName.length - 1; for (int i = 0; i < lastNameIndex; i++) { firstName += splitName[i] + " "; } <START> lastName = splitName[lastNameIndex]; <END> export += Sanitizer.sanitizeForCsv(team.name) + "," + Sanitizer.sanitizeForCsv(firstName) + "," + Sanitizer.sanitizeForCsv(lastName) + "," + Sanitizer.sanitizeForCsv(studentStatus) + "," + Sanitizer.sanitizeForCsv(student.email) + Const.EOL; } } } return export; }</code><technical_language>add a String[] splitName(String name) method StringHelper? need this in other places. Also, want <LINK_0></technical_language>

Target:
public String getCourseStudentListAsCsv(String courseId, String googleId) throws EntityDoesNotExistException { HashMap<String, CourseDetailsBundle> courses = getCourseSummariesForInstructor(googleId); CourseDetailsBundle course = courses.get(courseId); boolean hasSection = hasIndicatedSections(courseId); String export = ""; export += "Course ID" + "," + Sanitizer.sanitizeForCsv(courseId) + Const.EOL + "Course Name" + "," + Sanitizer.sanitizeForCsv(course.course.name) + Const.EOL + Const.EOL + Const.EOL; if(hasSection){ export += "Section" + ","; } export += "Team,First Name,Last Name,Status,Email" + Const.EOL; for (SectionDetailsBundle section : course.sections) { for (TeamDetailsBundle team : section.teams) { for(StudentAttributes student : team.students){ String studentStatus = null; if(student.googleId == null || student.googleId.equals("")){ studentStatus = Const.STUDENT_COURSE_STATUS_YET_TO_JOIN; } else { studentStatus = Const.STUDENT_COURSE_STATUS_JOINED; } if(hasSection){ export += Sanitizer.sanitizeForCsv(section.name) + ","; } String[] splitName = StringHelper.splitName(StringHelper.removeExtraSpace(student.name)); export += Sanitizer.sanitizeForCsv(team.name) + "," + Sanitizer.sanitizeForCsv(splitName[0]) + "," + Sanitizer.sanitizeForCsv(splitName[1]) + "," + Sanitizer.sanitizeForCsv(studentStatus) + "," + Sanitizer.sanitizeForCsv(student.email) + Const.EOL; } } } return export; }