Jump to content
Sign in to follow this  
blumi

Check if a string contains a @CRLF at the end

Recommended Posts

blumi

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

Share this post


Link to post
Share on other sites
UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
blumi

Works fine, thank you UEZ

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
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
Sign in to follow this  

×