Jump to content

Join multiple strings


Floppy
 Share

Recommended Posts

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.

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...