Sign in to follow this  
Followers 0
BeadzCrazy

Send() only specified number of characters?

7 posts in this topic

I have an existing script that I would like to edit to only send a specified number of characters from an array.

My script reads a file into an array and then later on it uses some of the data to send text to the screen. I would like to tell it to only send a maximum of 30 characters in some cases and ignore the rest of teh string. Is this possible witout changing how i read the file into the array? I do not want to change that aspect of the script becasue I do have a need to send the rest of the text string later on. so its prefered to just select how many characters to send on the fly.

Can someone help?

Share this post


Link to post
Share on other sites



Can someone help?

Someone, (maybe even me ;)) , could probably help you better if you posted the code you have so far.

- 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

what chimaera said:

Global $Array[2] = ["dahjsfhkjsahfdkjhasasdhfkjsafsdfgdsfgdsfgs" , "23894712897359821759832759398215798437594954629756987436439"]


for $i = 0 to ubound($Array) - 1
If stringlen($Array[$i]) >= 30 Then
    $string = stringleft($Array[$i] , 30)
Else
    $string = $Array[$i]
EndIf

msgbox (0, '' , $string)

Next

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks guys... StringLeft() is exactly what i was looking for!

also... @BothThose -- thanks for the idea with the StringLen() , i think i'll impliment that as well.

Edit: oh perhaps i spoke too soon... i forgot this would require me to create a new variable to hold the new string created by StringLeft()... so i guess there isn't a way to just send a string and cut it off at 30 characters on the fly... such as:

Send($array[53], 30)  ; Send 30 characters from $array[53]

i was looking for a way to not have to create new variables either... oh well i guess... thanks anyways...

Edited by BeadzCrazy

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