Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
20
Task/String-length/Mercury/string-length-2.mercury
Normal file
20
Task/String-length/Mercury/string-length-2.mercury
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
:- module string_character_length.
|
||||
:- interface.
|
||||
|
||||
:- import_module io.
|
||||
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
|
||||
:- implementation.
|
||||
|
||||
:- import_module list, string.
|
||||
|
||||
main(!IO) :-
|
||||
Words = ["møøse", "𝔘𝔫𝔦𝔠𝔬𝔡𝔢", "J\x332\o\x332\s\x332\e\x301\\x332\"],
|
||||
io.write_list(Words, "", write_length, !IO).
|
||||
|
||||
:- pred write_length(string::in, io::di, io::uo) is det.
|
||||
|
||||
write_length(String, !IO) :-
|
||||
NumChars = count_codepoints(String),
|
||||
io.format("%s: %d characters\n", [s(String), i(NumChars)], !IO).
|
||||
Loading…
Add table
Add a link
Reference in a new issue