Skip to content

updated the skeleton project with my complete project.#20

Open
pnarasimhan2021 wants to merge 2 commits intomainfrom
Priyanka_Narasimhan_CodeReview
Open

updated the skeleton project with my complete project.#20
pnarasimhan2021 wants to merge 2 commits intomainfrom
Priyanka_Narasimhan_CodeReview

Conversation

@pnarasimhan2021
Copy link

No description provided.

Copy link

@aravindrsripada aravindrsripada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Priyanka! Your code looks great. I added some feedback which really just show alternate ways to do what your code does. Keep up the good work!

}

String result = new String();
result = result.concat(str.charAt(0) + "");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This portion of the for loop in the removeNthCharacter() method seems to have some redundant code. Is there an advantage to starting your for loop at index = 1?

return 0;
}

String[] splitStr = str.split("\\s+");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like how you used the split method with regex to get the appropriate count of words. I will definitely be implementing this into my own code. Thank you

result = result.concat(str.charAt(0) + "");
for (int i = 1; i < str.length(); i++) {
if((i+1) % n != 0) {
result = result.concat(str.charAt(i) + "");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is personal preference but I like using += when concatenating strings together. Personally I think that nesting methods inside one another makes code harder to read.

public void testRemoveNthCharacter5() {
fail("Not yet implemented");
manipulatedstring.setString("I'd b3tt3r put s0me d161ts in this 5tr1n6, right?");
Throwable exception = assertThrows(IndexOutOfBoundsException.class, () -> manipulatedstring.removeNthCharacter(100, false));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can use the assertThrows() method without having to set it equal to a Throwable object. The assertThrow() method checks to see whether the method you provided in the lambda function returns the same Throwable as the Throwable you claim it will throw. Your way of checking definitely works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants