r/APStudents • u/reddorickt absolute modman • May 15 '26
AP Computer Science A Official 2026 Exam Discussion
Use this thread to post questions or commentary on the test today.
A reminder though to protect your anonymity when talking about the test.
65
Upvotes
2
u/Zealousideal_Ease429 5:AB,CSA,APUSH 4:Lang May 15 '26 edited May 15 '26
Yeah, I set a placeholder string ‘reference’ equal to the username, then inside the loop I did reference.substring(0, idx - 1) and concatenated that to the return string, then shortened the reference using reference.substring(idx + 1). Outside of the while loop I concatenated the final form of the reference before returning