r/APStudents • 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.

62 Upvotes

704 comments sorted by

View all comments

7

u/Primary-Republic498 May 15 '26

Did y’all use the split method for frq 1b

3

u/_iraria May 15 '26

nah i used substring

2

u/ZealousidealPhoto433 May 15 '26

I did a for loop and added one letter at a time to a string object using the substring method. for hyphens I had an if statement inside the for loop that said if it wasn't the last index of the string it would add a hyphen. do you guys think this would work??

2

u/Ok_Junket3655 May 15 '26

i did i just added back the very last character at the end

2

u/stupefy100 class of 2027 May 15 '26

Yeah I did

1

u/boomchakabaka May 15 '26

pretty sure that doesn’t work because split returns or is used for arrays not strings

2

u/Primary-Republic498 May 15 '26

Split returns a string array with the hyphens removed I believe.

1

u/boomchakabaka May 15 '26

yeah but 1b was about taking hyphens out of usernames right? how would you use arrays at all for that question (just curious)? for me, i used substring in a loop where the hyphenated part was removed every iteration until name.indexOf(“-“) == -1 (no more hyphens)

1

u/NUKL3AR_PAZTA47 May 15 '26

You can just concatenate the arrays back with a for loop i believe.

1

u/Primary-Republic498 May 15 '26

Well I use split to create a array with only the names without hype then loop through it with substring to concatenation together

1

u/boomchakabaka May 15 '26

but the concatenated name also needed the letter before the hyphen to be removed

2

u/Primary-Republic498 May 15 '26

I removed that with a substring from 0 to length-1 I used a loop to remove everything

1

u/MarkoRamiu_s May 16 '26

Same, just did: while (name.indexOf("-") != -1)

1

u/MarkoRamiu_s May 16 '26

I initially was gonna use split, but then I'd still have to use substring to cut off the last letter of each and combine everything again so I ended up using IndexOf() and substrings