Format 1: hasspace(, length)
Format 2: hasspacew(, length)
This function returns true if there is whitespace characters in character string and false if not. Whitespace characters is represented as ASCII code 0X20 to 0x09-0x0d. The respective ASCII code are represented as: single byte space (0x20), horizontal tab (0x09), new line (0x0a), vertical tabulation (0x0b), new page (0x0c), carriage return (0x0d). Use hasspacew to search for multibyte white space character.
Returns true if str column contains white space characters. The first row where id=1contains single-byte space character, in addition, the second row where id=2 contains tab character, thus, these two rows return true. However, records where the function returns false are id=4 which contains carriage return, and id=3 which contains double-byte space character.
$ more dat1.csv id,str 1,a b 2,ab c 3,ab c 4, 5,"aa bb" $ mcal c='hasspace($s{str})' a=rsl i=dat1.csv o=rsl1.csv #END# kgcal a=rsl c=hasspace($s{str}) i=dat1.csv o=rsl1.csv $ more rsl1.csv id,str,rsl 1,a b,1 2,ab c,1 3,ab c,0 4,,0 5,"aa bb",1
Use hasspacew function to detect double character space.
$ mcal c='hasspacew($s{str})' a=rsl i=dat1.csv o=rsl2.csv #END# kgcal a=rsl c=hasspacew($s{str}) i=dat1.csv o=rsl2.csv $ more rsl2.csv id,str,rsl 1,a b,1 2,ab c,1 3,ab c,0 4,,0 5,"aa bb",1