Sign in to follow this  
Followers 0
milad

get length of data ?

6 posts in this topic

hello my friends.

I write an Autoit script for my project .

now I have a string in my project and need too check the string length . and if string length is larger than 100 characters, get just 100 characters from 1 too 100 .

can anyone help me ?

for example :

check $data length

$length = $data length

if $length > 100 -then-> $data = first 100 characters of $data

Share this post


Link to post
Share on other sites



thanks a lot .

now I get the $data length

$Ln = StringLen ( $Data ) 
    if $Ln > 100 Then
    $Data = ...
    EndIf

I need to set $data = first 100 characters of $data if Ln > 100 characters .

Share this post


Link to post
Share on other sites

Try this..

If $Ln > 100 Then $Data = StringLeft($Data, 100)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Actually, you don't even need to do the StringLen() check, you can just do

$Data = StringLeft($Data, 100)

If the string is shorter than 100, it's not altered.

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  
Followers 0