CTOBIT() Converts a character string into a bit pattern ------------------------------------------------------------------------------ Syntax CTOBIT(<cCharacterstring>,<cBitpattern>) --> nWORD Arguments <cCharacterstring> Designates a character sequence. When this sequence occurs in the second character string, each corresponding bit is set to 1. <cBitpattern> Designates a sequence, with a maximum of 16 characters, from which the bit position is assigned. Returns CTOBIT() returns a number in the range of 0 to 65535 that corresponds to the created bit pattern. Description The CTOBIT() function delivers a bit pattern that corresponds to a string of individual characters. When used in conjunction with its sister function BITTOC(), it facilitates work with such bit-coded information as file attributes. Note . Characters in <cCharacterstring> that are not found in <cBitpattern> are ignored. Examples . The second bit in the resulting value is set, since the letter "H" appears in the next-to-last position in "ADVSHR": ? CTOBIT("H", "ADVSHR") // Result: 00000010 . Two characters also in ADVSHR, appear at the first and final positions in this 6-character string: ? CTOBIT("RA", "ADVSHR") // Result: 00100001 . <cBitpattern> ignores previously unavailable characters: ? CTOBIT("XRYA", "ADVSHR") // Result: 00100001
See Also: BITTOC() NTOC()