/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/fundamentals/runtime-libraries/snippets/System/String/Overview/fsharp/index11.fs
16 строк
472 B
Genevieve Warren
Add remarks for core types (#38970)
05 янв 2024, 22:14
Не верифицирован
05 янв 2024, 22:14
71d1377
Код
Авторство
О чём код?
module index11.fs open System // <Snippet4> let s1 = "This string consists of a single short sentence." let mutable nWords = 0 for i = 0 to s1.Length - 1 do if Char.IsPunctuation s1[i] || Char.IsWhiteSpace s1[i] then nWords <- nWords + 1 printfn $"The sentence\n {s1}\nhas {nWords} words." // The example displays the following output: // The sentence // This string consists of a single short sentence. // has 8 words. // </Snippet4>