FibonacciNumber

This commit is contained in:
shellhub
2019-10-29 12:40:39 +08:00
parent cbc1899b38
commit e141a33fa7
4 changed files with 68 additions and 61 deletions

View File

@ -2,13 +2,6 @@ package Others;
import java.util.Scanner;
/**
* @author blast314
* <p>
* Counts the number of characters in the text.
*/
public class CountChar {
public static void main(String[] args) {
@ -20,11 +13,12 @@ public class CountChar {
}
/**
* @param str: String to count the characters
* @return int: Number of characters in the passed string
* Count non space character in string
*
* @param str String to count the characters
* @return number of character in the specified string
*/
private static int CountCharacters(String str) {
str = str.replaceAll("\\s","");
return str.length();
return str.replaceAll("\\s", "").length();
}
}