Skip to content

remove empty words - #221

Merged
igorwojda merged 1 commit into
igorwojda:mainfrom
dev-shady:main
Sep 5, 2026
Merged

remove empty words#221
igorwojda merged 1 commit into
igorwojda:mainfrom
dev-shady:main

Conversation

@dev-shady

Copy link
Copy Markdown
Contributor

Problem: if the string contained multiple whitespaces like a Tab , IndexOutOfBound Exception will come for it[0] part.
Cause: splitting with " " will create empty strings in the array. Accessing 0th index in empty string will cause the crash.
Solution: Fix it by removing empty strings before doing uppercase transformation.

for example,
input: "hello from this side"
exception : Exception in thread "main" java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

After fix: Hello From This Side

if the string contained multiple whitespaces like a Tab , IndexOutOfBound Exception will come for it[0] part. Fix it by removing empty strings.
@igorwojda
igorwojda merged commit 608e72c into igorwojda:main Sep 5, 2026
1 check failed
@igorwojda

Copy link
Copy Markdown
Owner

Thx for the contribution

I have added a test to better cover this case #232

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