======String Operators====== String Operators perform various operations on the terms specified. There are several different types of operation available. ^ Symbol ^ [[PTPScript:Operators#Operator Types|Type]] ^ Name ^ Description ^ Example ^ | **[[Arithmetic|Arithmetic]]** ||||| | %% ~ %% | Infix | Concatenation | Joins the right term to the end of the left term | ''%% a ~ b %%'' | | %% ~* %% | Infix | Repetition | Repeats the left term by the number specified by the right term | ''%% a ~* b %%'' | | **[[Bitwise|Bitwise]]** ||||| | %% ~& %% | Infix | AND | Bits that are set in both left and right terms are set | ''%% a ~& b %%'' | | %% ~| %% | Infix | OR | Bits that are set in either left or right terms are set | ''%% a ~| b %%'' | | %% ~^ %% | Infix | XOR | Bits that are set in either left or right terms, but not both, are set | ''%% a ~^ b %%'' | | %% ~^ %% | Prefix | NOT | All bits in the term are inverted | ''%% ~^ a %%'' | | %% ~< %% | Infix | Shift left | Shift the bits of the left term left by the number of steps specified in the right term | ''%% a ~< b %%'' | | %% ~> %% | Infix | Shift right | Shift the bits of the left term right by the number of steps specified in the right term | ''%% a ~> b %%'' | | **[[Type Casting|Type Casting]]** ||||| | %% ~ %% | Prefix | Cast | Converts the term to a String | ''%% ~a %%'' | | **[[Type Checking|Type Checking]]** ||||| | %% is %% | Infix | IsType | Checks if the value of the left term is of the type specified by the right term | ''a~~~is~~~string'' | Each Operator will evaluate the terms provided as appropriate to the Operator [[PTPScript:Types|value type]] - for instance, performing a concatenation on two Numbers will convert the Numbers to Strings first.