String Theory

mccizmt2mccizmt2 Member Posts: 21
Hi all,

Is there a C/AL function that allows you to search for a character string within another.

e.g. FINAL EXAM

and I want to know if FINAL is in the above string or not?

Please can somebody help.

Comments

  • kikkomankikkoman Member Posts: 57
    hey mccizmt2,

    you can use

    STRPOS (String)
    -Use this function to search for a substring inside a string.

    Position := STRPOS(String, SubString)
    Position
    Data type: integer
    The position of SubString in String. If the system cannot find SubString, it returns zero (0).

    String
    Data type: text constant or code
    The string you want to search in.

    SubString
    Data type: text constant or code
    The string you want to search for. The STRPOS function is case-sensitive.

    Comments
    The STRPOS function only returns the position of the first occurrence of the substring.
  • jekingcomjekingcom Member Posts: 18
    Sure you can use a couple, but the easiest is the STRPOS function.

    Text1 := 'FINAL EXAM';
    SubStr := 'FINAL';
    IF STRPOS(Text1, SubStr) > 0 THEN ....
    *************************************
    NAV, CRM, MOSS, CMS, Commerce Server
    Justin King
    Brulant, Inc
    www.brulant.com
    justin.king at brulant.com
Sign In or Register to comment.