var[n] = expr,is vector?

It could be many things, depending on how you created the variable var

- if you used local var=vec.create... , it's a vector reference
- if you used local var=map.create..., it's a map reference
- if you used some other plugin that supports overloading the [] syntax, it 
depends on the plugin what happens

otherwise, if var is just a plain string, then it depends on n.  If n is a 
number, it picks up the nth character

if n is a string which is not a number, it is a regular expression match and 
replace





> 
> 
> You can use the syntax var[n]  to reference a character in the string held by 
> the variable and var[n,m] to represent an inclusive range.  Here n and m 
> represent any expression yielding an integer.  The first character is 
> numbered 0.  For negative integers, -n is equivalent to length(var)-n (so ? 
> is the last character).  You can use
> 
> var[n] = expr
> 
> to replace the nth character in the string by the expr, which can be any 
> length (including 0).  Samples: 
> 
> local var="abcde"
> var[0]   // yields "a"
> var[2,3]   // yields "cd"
> var[-5,-2]   // yields "abcd"
> var[3]="*" // sets var to abc*e
> var[3]="123" // sets var to abc123e
> var[1,4]="" // sets var to "a"
>


Reply via email to