String split question - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: String split question (/showthread.php?tid=2516) |
String split question - Trond Hoyem - 16.03.2020 Hi I need to extract the last part of different group names. I use the string.split() for this. What I get is for example; Code: kode = string.split(grp.find(event.dst).name, ' ') * table: [1] * string: 08-09 [2] * string: UTE+08=564.004-RM003-UTE [3] * string: BLIND [4] * string: vest [5] * string: ALARM_WIND I always want to get the last part of the string, but there are not the same number og spaces in every group name, and so I need to always get the last string in the table. For this particulare example, I could just add [5] to get it, but in another group that might return nil or even the wrong part of the name. So basically; how can I find the highest row number in the table? RE: String split question - admin - 16.03.2020 Code: last = kode[ #kode ] RE: String split question - Trond Hoyem - 16.03.2020 (16.03.2020, 07:43)admin Wrote:Perfect! Thx! |