diff --git a/.replaycheck/docs/csharp/how-to/parse-strings-using-split.yml b/.replaycheck/docs/csharp/how-to/parse-strings-using-split.yml new file mode 100644 index 0000000000000..15ee98ef716cd --- /dev/null +++ b/.replaycheck/docs/csharp/how-to/parse-strings-using-split.yml @@ -0,0 +1,113 @@ +# %version 1 +contentPath: docs\csharp\how-to\parse-strings-using-split.md + +steps: +- task: RunCodeSnippetReference@1 + environment: + type: dotnet-try + outputValidationRules: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + uid: 54d6d90f +- task: RunCodeSnippetReference@1 + environment: + type: dotnet-try + outputValidationRules: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: <> + - operator: contains + value: + - operator: contains + value: + - operator: contains + value: + uid: 56bddea1 +- task: RunCodeSnippetReference@1 + environment: + type: dotnet-try + outputValidationRules: + - operator: contains + value: "Original text: 'one" + - operator: contains + value: "two three:four,five six seven'" + - operator: contains + value: "7 words in text:" + - operator: contains + value: "" + - operator: contains + value: "" + - operator: contains + value: "" + - operator: contains + value: "" + - operator: contains + value: "" + - operator: contains + value: "" + - operator: contains + value: "" + uid: cd358438 +- task: RunCodeSnippetReference@1 + environment: + type: dotnet-try + outputValidationRules: + - operator: contains + value: "Original text: 'one" + - operator: contains + value: "two :,five six seven'" + - operator: contains + value: "7 words in text:" + - operator: contains + value: "" + - operator: contains + value: "" + - operator: contains + value: "<>" + - operator: contains + value: "" + - operator: contains + value: "" + - operator: contains + value: "" + uid: c6bd73cc +- task: RunCodeSnippetReference@1 + environment: + type: dotnet-try + outputValidationRules: + - operator: contains + value: "3 substrings in text:" + - operator: contains + value: "one" + - operator: contains + value: "two" + - operator: contains + value: "three :::code language="csharp" interactive="try-dotnet-method" source="../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs" id="Snippet1"::: Every instance of a separator character produces a value in the @@ -27,6 +28,7 @@ returned array. Consecutive separator characters produce the empty string as a value in the returned array. You can see how an empty string is created in the following example, which uses the space character as a separator. + :::code language="csharp" interactive="try-dotnet-method" source="../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs" id="Snippet2"::: This behavior makes it easier for formats like comma-separated values (CSV) @@ -41,14 +43,17 @@ the result sequence. The following example uses spaces, commas, periods, colons, and tabs as separating characters, which are passed to in an array. The loop at the bottom of the code displays each of the words in the returned array. + :::code language="csharp" interactive="try-dotnet-method" source="../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs" id="Snippet3"::: Consecutive instances of any separator produce the empty string in the output array: + :::code language="csharp" interactive="try-dotnet-method" source="../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs" id="Snippet4"::: can take an array of strings (character sequences that act as separators for parsing the target string, instead of single characters). + :::code language="csharp" interactive="try-dotnet-method" source="../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs" id="Snippet5"::: ## See also