CharNot()

CHARNOT()

Process each character in a string with bitwise NOT operation

Syntax

      CHARNOT( <[@]cString> ) --> cNotString

Arguments

<[@]cString> string to be processed

Returns

<cNotString> string with bitwise negated characters

Description

The CHARNOT() function constructs a new string from the string passed as parameter. To do this, it performs a bitwise NOT operation to the characters of the string and places a character in the resulting string whose ASCII value equals to the result of that operation. It can be easily seen that the resulting ASCII-value equals 255 minus input ASCII value. If the string is passed by reference, the resulting string is stored in <cString>, too. By setting the CSETREF()-switch to .T., the return value can be omitted.

Examples

      ? charnot( chr( 85 ) + chr( 128 ) + chr( 170 ) + chr( 1 ) ) 
// --> chr( 170 ) + chr( 127 ) + chr( 85 ) + chr( 254 ) ? charnot( charnot( "This is a test!" ) ) --> "This is a test!"

Tests

      charnot( chr( 85 ) + chr( 128 ) + chr( 170 ) + chr( 1 ) ) ==;
chr( 170 ) + chr( 127 ) + chr( 85 ) + chr( 254 ) charnot( charnot( "This is a test!" ) ) == "This is a test!"

Compliance

CHARNOT() is compatible with CT3’s CHARNOT().

Platforms

All

Files

Source is charop.c, library is ct3.

Seealso

CHARADD(), CHARSUB(), CHARAND(), CHAROR(), CHARXOR(), CHARSHL(), CHARSHR(), CHARRLL(), CHARRLR(), CSETREF()

2 responses to “CharNot()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – C | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.