This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
b92aaea7-be43-492d-a494-0f1ad5718b4f
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sharing
Vienna University of Technology
b92aaea7-be43-492d-a494-0f1ad5718b4f
Commits
b513fedb
Commit
b513fedb
authored
1 month ago
by
OEResource sharing
Browse files
Options
Downloads
Patches
Plain Diff
Update file RepeatCharacterSolution.java for resource with id: b92aaea7-be43-492d-a494-0f1ad5718b4f
parent
fd93b55c
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RepeatCharacterSolution.java
+3
-12
3 additions, 12 deletions
RepeatCharacterSolution.java
with
3 additions
and
12 deletions
RepeatCharacterSolution.java
+
3
−
12
View file @
b513fedb
...
...
@@ -2,28 +2,19 @@ package Solutions;
public
class
RepeatCharacterSolution
{
private
static
String
repeatCharacter
(
String
text
,
int
number
,
char
target
)
{
private
static
String
repeatCharacter
(
String
text
,
int
number
,
char
target
){
String
result
=
""
;
target
=
Character
.
toLowerCase
(
target
);
for
(
int
i
=
0
;
i
<
text
.
length
();
i
++)
{
char
currentChar
=
text
.
charAt
(
i
);
if
(
Character
.
isUpperCase
(
currentChar
))
{
target
=
Character
.
toUpperCase
(
target
);
}
if
(
currentChar
==
target
)
{
if
(
currentChar
==
target
){
for
(
int
j
=
0
;
j
<
number
;
j
++)
{
result
+=
target
;
}
number
--;
}
if
(
currentChar
!=
target
)
{
}
else
{
result
+=
currentChar
;
}
if
(
Character
.
isUpperCase
(
target
))
{
target
=
Character
.
toLowerCase
(
target
);
}
}
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment