Compare strings and number strings (download)

Source: Internet
Author: User
Tags number strings

Comparing strings and numeric strings

To compare strings (type C) and numeric literals (type N), you can use the following operators in logical expressions.

< operators > Meanings

CO contains only

CN contains not only

The CA contains any

NA does not contain any

CS contains string

NS does not contain strings

CP include mode

NP does not contain patterns

Because except for types N and C, the system cannot perform any other type conversions,

When calculating one of the comparisons, the operand should be of type N or C.

The functions of the operator are as follows:

CO (included only)

If <F1> contains only the characters in < f2>, the logical expression

<F1> CO <F2>

Is true. The comparison is case-sensitive and includes trailing spaces. If the comparison result is true, the system field Sy-fdpos

Include length of <F1>. If False, Sy-fdpos contains the first word in < f1> that does not appear within < f2>

The offset of the character.

CN (not only included)

If <F1> also contains characters other than < f2>, the logical expression

<F1> CN <F2>

Is true. The comparison is case-sensitive and includes trailing spaces. If the comparison result is true, the system field Sy-fdpos

Contains the offset of the first character in <F1> that does not appear in both < f2>. If it is false, Sy-fdpos bag

Length of <F1> included.

CA (contains any)

If <F1> contains at least one character of < f2>, the logical expression

<F1> CA <F2>

Is true. The comparison is case-sensitive. If the comparison result is true, the system field Sy-fdpos contains < f1>

The first one is also the offset of the characters that appear in <F2>. If False, Sy-fdpos contains the length of the < f1>.

NA (does not contain any)

If <F1> does not contain any characters for < f2>, the logical expression

<F1> NA <F2>

Is true. The comparison is case-sensitive. If the comparison result is true, the system field Sy-fdpos contains the long < f1>

Degree. If False, Sy-fdpos contains the offset of the first character that appears in <F1> in < f2>.

CS (contains string)

If <F1> contains string < F2>, the logical expression

<F1> CS <F2>

Is true. Trailing spaces are ignored and comparisons are not case-sensitive. If the comparison result is true, the system field

The Sy-fdpos contains <F2> offsets in <F1>. If False, Sy-fdpos contains the length of the < f1>.

NS (does not contain strings)

If <F1> does not contain a string < F2>, the logical expression

<F1> NS <F2>

Is true. Trailing spaces are ignored and comparisons are case insensitive. If the comparison is true, the system field Sy-fdpos contains

Length of the <F1>. If False, the system field Sy-fdpos contains < f2> offset in < f1>.

CP (inclusive mode)

If <F1> contains patterns < F2>, the logical expression

<F1> CP <F2>

Compare strings and number strings (download)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.