> On 3 Oct 2016, at 19:17, Jean-Denis Muys via swift-users
> wrote:
>
> You are right: I don’t know much about asian languages.
>
> How would you go about counting consonants, vowels (and tone-marks?) in the
> most general way?
Iterate over unicodeScalars (in the most general case) - Swift c
You are right: I don’t know much about asian languages.
How would you go about counting consonants, vowels (and tone-marks?) in the
most general way?
I think I would need to educate myself about those things. Any pointer welcome.
JD
> On 3 Oct 2016, at 12:52, Gerriet M. Denkmann wrote:
>
>
> On 3 Oct 2016, at 16:28, Jean-Denis Muys via swift-users
> wrote:
>
> ASCII? Probably not. Latin? perhaps, though not obvious. For example French
> accented letters would probably have to be handled somehow. Greek or
> Cyrillic? Perhaps. Other scripts? Unlikely, but what do I know.
Don’t b
You are perfectly right. The context is playing around really, but I was more
specifically writing a function counting vowels and consonants in an arbitrary
string:
func countLetters(s: String) -> (vowels: Int, consonants: Int) {
let vowels: Set = Set("AEIOU".characters)
let consonants:
On 2 Oct 2016, at 19:02, Jean-Denis Muys via swift-users
wrote:
> The problem is, I could not find a simple way to convert from a character to
> a unicodeScalar.
As is often the case with string examples, it would help if you posted more
about your context. With the details we have now you
on Sun Oct 02 2016, Jean-Denis Muys wrote:
> I was playing with CharacterSet, and I came up with:
>
> let vowels = CharacterSet(charactersIn: "AEIOU")
Yeah, because CharacterSet is a set of UnicodeScalars, not a set of
Character. That should probably get fixed somehow. I suggest filing a
rada
I was playing with CharacterSet, and I came up with:
let vowels = CharacterSet(charactersIn: "AEIOU")
let char: Character = "E"
vowels.contains(char)
That last line doesn't compile: I get "*cannot convert value of type
'Character' to expected argument type 'UnicodeScalar'*"
The problem is, I