Jump to content
Sign in to follow this  
Floppy

Join multiple strings

Recommended Posts

Floppy

Hello,

I have this script:

$random_first_name_letters=Random(1,10,1)
For $name_width=1 To $random_first_name_letters
$name=Chr(Random(Asc("a"),Asc("z"),1))
Next
MsgBox(0,"",$name)

Is there a way to show in the message-box all letters (joined) retrived by $name?

Thanks

Share this post


Link to post
Share on other sites
Andreik

Hello,

I have this script:

$random_first_name_letters=Random(1,10,1)
For $name_width=1 To $random_first_name_letters
$name=Chr(Random(Asc("a"),Asc("z"),1))
Next
MsgBox(0,"",$name)

Is there a way to show in the message-box all letters (joined) retrived by $name?

Thanks

Use & to join two strings or concatenation assignment (&=)

MsgBox(0,"",GetRandomChars())
MsgBox(0,"",GetRandomChars())
MsgBox(0,"",GetRandomChars())

Func GetRandomChars()
    $NUM = Random(1,10,1)
    $CHAR = ""
    For $INDEX = 1 To $NUM
        $CHAR &= Chr(Random(Asc("a"),Asc("z"),1))
    Next
    Return $CHAR
EndFunc
Edited by Andreik

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.