Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/String-length/Java/string-length-4.java
Normal file
19
Task/String-length/Java/string-length-4.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import java.text.BreakIterator;
|
||||
|
||||
public class Grapheme {
|
||||
public static void main(String[] args) {
|
||||
printLength("møøse");
|
||||
printLength("𝔘𝔫𝔦𝔠𝔬𝔡𝔢");
|
||||
printLength("J̲o̲s̲é̲");
|
||||
}
|
||||
|
||||
public static void printLength(String s) {
|
||||
BreakIterator it = BreakIterator.getCharacterInstance();
|
||||
it.setText(s);
|
||||
int count = 0;
|
||||
while (it.next() != BreakIterator.DONE) {
|
||||
count++;
|
||||
}
|
||||
System.out.println("Grapheme length: " + count+ " " + s);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue