You are given a string s
. Your task is to count the number of characters in the string and return the total amount of characters in the string with the type u32
.
chars()
method to get an iterator over the characters in the string.count()
method to count the number of elements in the iterator.The
count()
method returns ausize
which is the number of elements in the iterator. In the challenge you are asked to return au32
, you can use theas
keyword to convert theusize
to au32
. For example,let count_u32 = count as u32;