Re: string macro functions
Posted by
Straub, Volko A. (Dr.) on
Nov 18, 2020; 5:01am
URL: http://imagej.273.s1.nabble.com/string-macro-functions-tp5024194p5024195.html
Hi Leo,
Substring should do what you want. Try this:
ID="A09";
X=substring(ID,0,1);
print(X);
Cheers,
Volko
-----Original Message-----
From: Leoncio Vergara <
[hidden email]>
Sent: 18 November 2020 02:10
To:
[hidden email]
Subject: string macro functions
Hi
A very basic question: how do I use these string functions?
These string functions, where 's' is a string variable, are also available: s.charAt(i), s.contains(s2), s.endsWith(s2), s.indexOf(s2), s.lastIndexOf(s2), s.length, s.matches(s2), s.replace(s1,s2), s.startsWith(s2), s.substring(i1,i2), s.substring(i), s.toLowerCase, s.toUpperCase, s.trim.
they are mentioned in the built in macro functions list, but I couldn't figure to make them work. I get an error message.
for example for s.charAt(i), I tried the following:
ID="A09";
X=ID.charAt(1);
print(X);
thinking it would print "A" or "0"... but nope...
Thanks for your help.
Leo V.
--
ImageJ mailing list:
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=04%7C01%7Cvs64%40leicester.ac.uk%7C048d7ed8f5764bda387908d88b671ac8%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C1%7C637412622243719666%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=8elaNPu8wLV2sjA5iyM6QxIRqOfGuyn%2BNfDvH7lQqwI%3D&reserved=0--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html