s.fromn(ptr len [ptr2 len2 ...])
s - str variable.
ptr - string, or pointer to binary data.
len - number of bytes to copy from ptr. If -1, the function finds ptr length (ptr must be null-terminated string).
... - more ptr/len pairs.
This function can be used to join several strings (full or of specified length) or/and binary data. Max number of ptr/len pairs is 16.
Although str variables can contain binary data, many str functions work only with null-terminated strings.
See also: str.format with %m.
str s1="123456789" str s2="ABCDEFGHI" str s.fromn(s1 4 " " 1 s2 -1) ;;4 bytes from s1, space and s2 the same with format. If s1 is not binary data, can use s instead of m. s.format("%.4m %s" s1 s2) or s.format("%.*m %s" 4 s1 s2)