This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

First x chars of a string variable

Old posts that have not been replied to for several years.
Locked
j
joke
Voice
Posts: 13
Joined: Fri Aug 19, 2005 7:20 am
Location: Karlsruhe
Contact:

First x chars of a string variable

Post by joke »

Hi,

is it possible to create a variable with the first x chars of another string variable?

For example:

string1 -> "Hello world"
string2 -> First 5 chars of string1 -> "Hello"


Thx
User avatar
avilon
Halfop
Posts: 64
Joined: Tue Jul 13, 2004 6:58 am
Location: Germany

Post by avilon »

Code: Select all

set string2 [string range $string1 0 4]
j
joke
Voice
Posts: 13
Joined: Fri Aug 19, 2005 7:20 am
Location: Karlsruhe
Contact:

Post by joke »

Thx for the quick and correct answer. Script works fine now. :D
Locked