From: Prathit Chatterjee (pc20apr_at_REMOVE_yahoo.co.in)
Date: Thu Jun 04 2020 - 02:59:49 CDT

Thanks a lot
Regards,
Prathit
    On Thursday, 4 June, 2020, 04:50:31 pm GMT+9, Ashar Malik <asharjm_at_gmail.com> wrote:
 
 One way would be 
set a apple # split $a by character [split $a ""]
# it then becomes a list so you can use lrange [lrange [split $a ""] 0 2]
# app has index from 0 till 2. but the output of the above is a list - to get app use join[join [lrange [split $a ""] 0 2] ""]
the last command will return "app" (from index 0 to 2)
final code 
set a appleputs [join [lrange [split $a ""] 0 2] ""]

On Thu, Jun 4, 2020 at 12:24 PM Prathit Chatterjee <pc20apr_at_remove_yahoo.co.in> wrote:

Dear VMD experts,

This is regarding selecting selected characters of a variable with tcl scripting in VMD.
I want to select first few characters of a variable, for example, first three characters (app) of the variable "apple":
======
vmd > set a apple
apple
vmd > string length $a
5
======
I am trying to play around with the command string but could not figure out so far.

Any relevant comments/suggestions will be greatly appreciated.
Thank you in advance,
Regards,
Prathit

-- 
Best,/A