Jump to content

Check if a string contains a @CRLF at the end


 Share

Recommended Posts

How is a @CRLF treated in AutoIt?

I read a file and have a string.

I want to check if at the end of the string is a @CRLF or not.

Tried this:

If (StringInStr($string, StringRight($string, 3)) = @CRLF) Then
Link to comment
Share on other sites

Try this:

$txt = "This is a text" & @CRLF

If StringInStr(StringRight($txt, 2), @CRLF) Then
    MsgBox(0, "Test", "Found CRLF at the end of the string!")
Else
    MsgBox(0, "Test", "Not Found CRLF at the end of the string")
EndIf

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Why it's need to call StringInStr, isn't enough to check the last two chars?

$txt = "This is a text" & @CRLF
If StringRight($txt, 2) = @CRLF Then
    MsgBox(0, "Test", "Found CRLF at the end of the string!")
Else
    MsgBox(0, "Test", "Not Found CRLF at the end of the string")
EndIf

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...