[Gmsh] substring in gmsh script

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon Nov 28 20:09:30 CET 2016


> On 25 Nov 2016, at 14:43, Олег Рябков <oleg.ryabkov.87 at gmail.com> wrote:
> 
>    Dear mesh users and developers.
> Given some string (in gmsh script), for example, view name 
> test = Str( View[0].Name );
> which can be printed using:
> Printf(test);
> I want to get substring of this string, for example first 5 characters of 5 last ones. But i don't see any built-in functions for this purpose.

Indeed, there were none. I've added them: you can now do e.g.

test = StrSub( View[0].Name , start );

or

test = StrSub( View[0].Name , start , len);

Christophe

> None of expressions work for me as well. 
> For example, there is documented syntax 
> expression
> :
>   
> real
>  |
>   
> string
>  |
>   
> string ~ { expression
>  }
>   
> string [ expression ] |
> 
> But test[1] is not working (out of range index). I suppose i don't understand some differences between lists, strings, char-expressions and something like that. 
> 
> Is there any way to do what i want?
> 
> -- 
>   Best regards, Oleg
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine

Free software: http://gmsh.info | http://getdp.info | http://onelab.info




More information about the gmsh mailing list