How to do string contains in drools.

hi everyone
i'm using drools for a project and have come to a problem. in two of my rules i need to check if a string contains some characters but can't seem to do get the rules to be excepted. if anyone could help me i would be very grateful.
thanks in advance
mike

Display the rules.

Similar Messages

  • How to find string contain.

    Dear all,
    i want to find some char from a given string like below example
    vtext = PM-BGM12_AC :
    if vtext contain '_AC'  then i have to assinge btext = ' Air Conditioner'.
    if vtext = PM-BGM12_BPI  contain '_BPI',
    then i have to assign btext = ' Building & Permanent Improvement '
    i m consfuse what to user ca , co, cs, cp.
    *********point is assured *********

    hi,
    chk out this
    <b><b>CO</b></b> Contains Only:  True, if operand1 only contains characters from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand2 is of type string and is initial, then the logical expression is false, unless operand1 is also of type string and is initial, in which case the logical expression is always true. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1, that is not contained in operand2. If the result of the comparison is positive, sy-fdpos contains the length of operand1.
    <b>CN</b> Contains Not Only; True if a logical expression with CO is false, that is, if operand1 contains not only characters from operand2. sy-fdpos is set in the same way as for CO. If the comparison is true, sy-fdpos contains the offset of the first character in operand1 that is not contained in operand2. If the comparison is false, sy-fdpos contains the length of operand1.
    CA Contains Any: True, if operand1 contains at least one character from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand1 or operand2 is of type string and initial, the logical expression is always false. If result of the comparison is positive, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
    <b>NA</b> Contains Not Any: True if a logical expression with CA is false, that is if operand1 does not contain any characters from operand2. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is true, sy-fdpos contains the le of operand1.
    CS Contains String: True if the content of operand2 is contained in operand1. Upper/lower case is not taken into account, trailing blanks of the left operand are taken into account. If operand1 is of type string and initial, or of type c and contains only blank characters, the logical expression is false, unless operand2 is also of type string and initial, or of type c and only contains blank characters. In this case the logical expression is always true. If the result of the comparison is true, sy-fdpos contains the offset of operand2 in operand1. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
    <b>NS</b> Contains No String: True, if a logical expression with CS is false, that is if operand1 does not contain the content of operand2. If the result of the comparison is negative, sy-fdpos contains the offset of operand2. If the comparison is true, sy-fdpos contains the length of operand1.
    <b>CP</b> Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand2 pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1. You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.
    <b>NP</b> No Pattern: True, if a logical expression with CP is false, that is, if operand1 does not fit the pattern operand2. If the comparison is false, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "*" in operand2 are ignored if operand2 also contains other characters. If the comparison is true, sy-fdpos contains the length of operand1.
    thanks
    jaideep
    *reaward points if useful..

  • How to write strings containing " ?

    I have the following string: blabla"blabla
    How can I specify that the " is inside the string and ignore
    it as as3 code symbol ?
    thanks

    That depends upon your need of this, may use some simple
    logic which is suitable for your need.

  • How to convert string containing comma seperated values to an array

    my requirement is i have to first convert an comma seperated string to an array
    after that i have to pass the array values to a for loop
    eg:i have a string str=(456,457,487,465,478)
    These values i have to put in an array.
    i then i have to pass the array values to a for loop

    We understand your ¿homeworks? We are helping you, but it seems like you want us to do it.
    Try it yourself with some of the instructions.
    Anyway if there aren´t homeworks, use dinamyc sql:
    declare
    varray := '(45,65,12,4)';
    begin
    execute immediate 'update table set ss=''uu'' where id in ' || varray;
    end;

  • How to replace string containing special characters by another string

    Hi all,
    I have to Search for a pattern and replace it by a substitute pattern [Eg: Replace methodOrig (a,b) with  SessTime = getSessionParameter(time);  methodNew(a,b,SessTime) ] in files.
    i tried this using replace(),but it din't work since string1 contains special characters.
    can anyone help me asap.
    thanks in advance.

    Double-post: http://forum.java.sun.com/thread.jspa?threadID=599211&tstart=0

  • Insert string containing '&'

    How to insert string containing '&' into a table
    INSERT INTO TBL_CHANGES_ORGANISATIES(CHANGE_MANAGEMENT_ID, SUBMITTER) VALUES ('HM0000002147848|TK0000003121328','CS CSU S\&B Change Management')

    if you're in sqlplus:
    put set define offprior to running your insert.
    if you're in Toad, either:
    put set define offbefore your insert statement, and run both in as a script
    OR
    right mouseclick on the editor and untick the "Prompt for substitution variables", and you need never worry about the & again!

  • How to find out whether the String contains chinese characters

    I need to check if the string contains chinese characters in Java. Does anyone know how to do it? thx.

    Since Java strings contain UNICODE code points, check the content against the relevant page here - http://www.unicode.org/charts/ .

  • How to parse a string containing xml data

    Hi,
    Is it possible to parse a string containing xml data into a array list?
    my string contains xml data as <blood_group>
         <choice id ='1' value='A +ve'/>
         <choice id ='2' value='B +ve'/>
             <choice id ='3' value='O +ve'/>
    </blood_group>how can i get "value" into array list?

    There are lot of Java XML parsing API's available, e.g. JAXP, DOM4J, JXPath, etc.
    Of course you can also write it yourself. Look which methods the String API offers you, e.g. substring and *indexOf.                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to determine if string contains HashSet item using LINQ

    Hi,
    I know how to iterate through a HashSet to see if an item is contained in a string.  But, I can't quite figure out how to do it with LINQ.
    Something like if( string.Contains(???))
    I would appreciate any help!
    Thanks much!!

    Thanks everyone.  I like the examples posted above.
    Actually, what I want to know is if any HashSet values can be found in a string using LINQ
    HashSet<string> terminals = new HashSet<string>();
    terminals.Add("FD4A");
    terminals.Add("FD4B");
    terminals.Add("FD4C");
    //a collection of a bunch of transactions done at various terminals
    List<string> transactionList = new List<string>();
    foreach (string transaction in transactionList)
        foreach (string terminal in terminals)
           if (transaction.Contains(terminal) == true)
                //this is one of the transactions I want - do something
                break;
    Thanks much and have a great weekend!!

  • How to Identify whether string contains only numbers

    Hi Experts,
    How to identify whether a string contains only numbers...
    Thanks & Regards,
    Neeraj.

    Hi Neeraj,
    ISNUMERIC(String_Field)
    The above function returns '0' for non-numerics and
    '1' for numeric
    Hope this helps.
    Regards,
    Bala

  • How to add a container object in a station globals

    Hi,
    How to add a container object in a station globals

    Hi radlou,
    This might be what you're looking for:
    NewSubProperty Method
    Syntax
    PropertyObject.NewSubProperty ( lookupString, ValueType, asArray, typeNameParam, options)
    Purpose
    Creates a new subproperty with the name the lookupString parameter specifies.
    Parameters
    lookupString As String
    [In] Pass the lookup string for the new subproperty to be created. If you pass a lookup string with multiple levels (such as "x.y.z"), this method creates all of the necessary intermediate container objects. Refer to lookup string for more information about the strings you can use.
    ValueType As PropertyValueTypes
    [In] Pass the type of value you want the new subproperty to store.
    asArray As Boolean
    [In] Pass True to make the new subproperty an array whose elements are of the type you specify in valueType.
    typeNameParam As String
    [In] Pass the name of an existing type if you want to create the new subproperty as an instance of a named type. Otherwise, pass an empty string. If you pass a type name, you must pass PropValType_NamedType for the ValueType parameter. Refer to NamedPropertyTypes for a list of built-in named types.
    options As Long
    [In] Pass 0 to specify the default behavior, or pass one or more PropertyOptions constants. Use the bitwise-OR operator to specify multiple options. You do not need to pass the InsertIfMissing option to create the new subproperty. Pass DoNothingIfExists if you want the method to not report an error if the subproperty already exists.

  • How to Split string ("39934,,\"VIE\",\"Cong, hoa, xa, hoi\"") ???

    My string is:
    String string = "39934,,\"VIE\",\"Cong, hoa, xa, hoi\""
    Now, i want to split into array:
    a[0]="39934"
    a[1]=""
    a[2]="\"VIE\""
    a[3]="\"Cong, hoa, xa, hoi\""
    How i do?

    thanhhaunv wrote:
    Now, i want to split into array:
    a[0]="39934"
    a[1]=""
    a[2]="\"VIE\""
    a[3]="\"Cong, hoa, xa, hoi\""[String.split()|http://java.sun.com/javase/6/docs/api/java/lang/String.html#split%28java.lang.String%29] will do the basics for you; but it's naive.
    ie, If any of your quoted strings contain commas and you don't want them split, you'll have to put them back together in a step 2.
    Winston

  • I want to know string contain symbol

    hhi
    i wana to know that if string contain symbol then remove the
    symbol from string
    i dont know which type of symbol is in string find and remove
    the symbol and put spacce
    like this
    string is ================"screen-capturing"
    result will be screen capturing
    tell me the result

    It would take a lot longer time that I have to explain how
    regular
    expressions work. And I only know the bare basics of them to
    begin
    with. Basically a regular expression is a pattern matching
    algorithm.
    You say what letters you want to find and what you want to do
    with those
    characters.
    function cleanString(vText){
    return vText.replace(/[^0-9a-z]|"_"/gi," ");
    In this example, the javascript replace function looks for
    the stuff in
    the beginning between the / marks and replaces it with the "
    " (space).
    The ^ character means "not" and everything in the brackets is
    what we
    are not looking for. i.e. it is saying that anything that is
    not a
    number (0-9) or a letter (a-z). Then the | pipe character
    means "or".
    So in addition to the non alphanumerics, it is also looking
    for "_" the
    underscore. Then after the last / are the switches. The g
    switch says
    to match all of the instances of the pattern (without the g,
    it would
    only replace the 1st one) and the i tells it to be
    case-insensitive..
    Now are you more confused than before?
    Here is a pretty good site with some more specific
    information about how
    the replace method works in Javascript:
    http://www.regular-expressions.info/javascript.html
    If you really want to get deep into regex, find the xtra for
    Director
    called pRegEx. It is free and super powerful and superfast.
    The
    documentation that comes with it is extremely detailed about
    all the
    different functions of regular expressions and how to use
    them in Director.

  • Evaluate a string containing a constant name

    Hi,
    how can I evaluate a string containing a constant name
    such as
    String a= " Integer.MAX_INT";
    thx a lot,
    tiz

    Er...no. Integer.MAX_INT is an int, and you can't call methods on primitive types. :-)
    What you might need to do is check for these constants and set the values yourself. Otherwise you'll have a load of difficulty parsing strings and what-not.

  • Unique regular expression to check if a string contains letters and numbers

    Hi all,
    How can I verify if a string contains numbers AND letters using a regular expression only?
    I can do that with using 3 different expressions ([0-9],[a-z],[A-Z]) but is there a unique regular expression to do that?
    Thanks all

    Darin.K wrote:
    Missed the requirements:
    single regex:
    ^([[:alpha:]]+[[:digit:]]+|[[:digit:]]+[[:alpha:]])[[:alnum:]]*$
    You either have 1 or more digits followed by 1 or more letters or 1 or more letters followed by 1 or more digits. Once that is out of the way, the rest of the string must be all alphanumerics.  The ^ and $ make sure the whole string is included in the match.
    (I have not tested this at all, just typed it up hopefully I got all the brackets in the right place).
    I think you just made my point.  TWICE.  While the lex class would be much more readable as a ring.... I know all my brackets are in the correct places and don't need to hope.
    Jeff

Maybe you are looking for