Skip to content

Commit

Permalink
create function for trunc name
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor authored and Victor committed Jan 23, 2023
1 parent de805a5 commit 628632a
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public String convert(String name, String lastname, int count) {

StringBuilder resultLine = new StringBuilder();

//region create name
String loverName = name.toLowerCase();
String prepareName = loverName.replace(masLinks[0][0], masLinks[0][1]);

Expand All @@ -87,11 +88,13 @@ public String convert(String name, String lastname, int count) {

firstSymbol = false;

int n = name.length();
int n = Math.min(count, prepareName.length());
for (int i = 1; i < n; i++) {
resultLine.append(convertSymbol(name.charAt(i)));
resultLine.append(convertSymbol(prepareName.charAt(i)));
}
//endregion

//region create last name
String lowerLastName = lastname.toLowerCase();
String prepareLastName = lowerLastName.replace(masLinks[0][0], masLinks[0][1]);

Expand All @@ -105,6 +108,7 @@ public String convert(String name, String lastname, int count) {
for (int i = 1; i < n; i++) {
resultLine.append(convertSymbol(prepareLastName.charAt(i)));
}
//endregion

return resultLine.toString();
}
Expand Down

0 comments on commit 628632a

Please sign in to comment.