/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
docs/fundamentals/runtime-libraries/snippets/System.Text/Rune/Overview/csharp/FindFirstLetter.cs
30 строк
884 B
Genevieve Warren
Add remarks for core types (#38970)
05 янв 2024, 22:14
Не верифицирован
05 янв 2024, 22:14
71d1377
Код
Авторство
О чём код?
using System; using System.Collections.Generic; using System.Text; namespace RuneSamples { public static class FindFirstLetter { public static void Run() { Console.WriteLine($"Index of first capital letter of Latin alphabet in \"𐓏𐓘𐓻𐓘𐓻𐓟F𐒻𐓟\": { GetIndexOfFirstAToZ("𐓏𐓘𐓻𐓘𐓻𐓟F𐒻𐓟")}"); // <SnippetExample> int GetIndexOfFirstAToZ(string s) { for (int i = 0; i < s.Length; i++) { char thisChar = s[i]; if ('A' <= thisChar && thisChar <= 'Z') { return i; // found a match } } return -1; // didn't find 'A' - 'Z' in the input string } // </SnippetExample> } } }