Dears,
How to check if last line of text file contains one word ? Thx
Dears,
How to check if last line of text file contains one word ? Thx
We can use variablename.ToString.EndsWith(“your term”) method
Or
If that doesn’t end with text rather just be there in the last line of the text then
This expression would help you
If the text is stored in str_input
Then
str_output = str_input.Split(Environment.Newline.ToArray()).last.ToString.Contains(“your keyword”).ToString
Cheers @hsendel
I tried both Methodes and didn’t work. Could you please help?CheckIfLastLineContainsWord.xaml (6.7 KB) Example.zip (384 Bytes)
Hello @hsendel
if you want to check the last word then you can use regex Ismatch method to get a boolean value and using this pattern yourword$
check this workflow if you want something like this and to understand more clearly
Ismatch.xaml (5.7 KB)
Hello @hsendel
The reason that code didnt work is its only checking the last word
i misread it
Try this code it’ll definitely work
System.Text.RegularExpression.Regex.IsMatch((System.Text.RegularExpression.Regex.Regex.Match(Your Variable,".+\z").ToString),"the desired word").ToString
Let me know about it
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.