Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions snippets/csharp/System/String/IndexOfAny/IndexOfAny1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ public static void Run()
char[] chars = { 'a', 'e', 'i', 'o', 'u', 'y',
'A', 'E', 'I', 'O', 'U', 'Y' };
String s = "The long and winding road...";
Console.WriteLine($"The first vowel in \n {s}\n" +
$"is found at index {s.IndexOfAny(chars)}");
Console.WriteLine($"""
The first vowel in
'{s}'
is found at index {s.IndexOfAny(chars)}
""");

// The example displays the following output:
// The first vowel in
// The long and winding road...
// 'The long and winding road...'
// is found at index 2
// </Snippet1>
}
Expand Down
6 changes: 4 additions & 2 deletions snippets/csharp/System/String/IndexOfAny/ixany2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public static void Run()
Console.WriteLine();
Console.WriteLine("The first character occurrence " +
$"from position {start} to {str.Length - 1}:");
Console.WriteLine($"{Environment.NewLine}{br1}{Environment.NewLine}" +
$"{br2}{Environment.NewLine}{str}{Environment.NewLine}");
Console.WriteLine($"""
{Environment.NewLine}{br1}{Environment.NewLine}
{br2}{Environment.NewLine}{str}{Environment.NewLine}
""");
Console.Write($"A character in '{target}' occurs at position: ");

at = str.IndexOfAny(anyOf, start);
Expand Down
6 changes: 4 additions & 2 deletions snippets/csharp/System/String/IndexOfAny/ixany3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ public static void Run()
Console.WriteLine();
Console.WriteLine("The first character occurrence from " +
$"position {start} for {count} characters:");
Console.WriteLine($"{Environment.NewLine}{br1}{Environment.NewLine}{br2}" +
$"{Environment.NewLine}{str}{Environment.NewLine}");
Console.WriteLine($"""
{Environment.NewLine}{br1}{Environment.NewLine}{br2}
{Environment.NewLine}{str}{Environment.NewLine}
""");
Console.Write($"A character in '{target}' occurs at position: ");

int at = str.IndexOfAny(anyOf, start, count);
Expand Down