|
Forum Index : Microcontroller and PC projects : LONGSTRING TRIM, maximum clippable length is LLEN - 1
| Author | Message | ||||
| jirsoft Guru Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Hi, I'm working right now with UDP communication with ESP and using LONGSTRINGs. I'm filling LONGSTRING with complete UDP buffer and after the packet is received, I need to read LF separated strings from it. After read I need to remove this parts from LONGSTRING, it works all the way except last one. I'm getting error, that maximum clippable part is LLEN - 1. Can this be in the future FW changed, so I can TRIM complete LONGSTRING? It shouldn't affect any existing program but increase effectivity. LF = STR$(10) DO WHILE LLEN(buf()) > 0 bufLen = LINSTR(buf(), LF) IF bufLen > 0 THEN part = LGETSTR$(buf(), 1, bufLen - 1) LONGSTRING TRIM buf(), bufLen 'this works up to last part, then error ENDIF LOOP now I have modified it to LF = STR$(10) DO WHILE LLEN(buf()) > 0 bufLen = LINSTR(buf(), LF) IF bufLen > 0 THEN part = LGETSTR$(buf(), 1, bufLen - 1) IF bufLen < LLEN(buf()) THEN LONGSTRING TRIM buf(), bufLen ELSE LONGSTRING CLEAR buf() ENDIF ENDIF LOOP Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), CMM2.fun |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |