Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 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