How to filter an array with a string value

I want to filter out all Strings in an array that don't have a certain value in them aka. I want only to see values that start with b or bi or bit etc...
How can I accomplish this?
Thanks

This is another one of those things where I'm surprised it's not in the JDK. It's needed sufficiently frequently, and other languages (esp. scripting languages) seem to support this thing commonly.
Anyway...when I need something like this (that seems as though many others need it as well and it ought to be in the JDK but isn't), the first thing I do is check Apache Jakarta Commons to see if someone has already written such a thing in a reasonably well-supported toolkit. It's worth a look.

Similar Messages

  • How to filter by attributes with type Strings

    The documentation is not really detailed about setting attributes with type Strings. I assume I've to type each string value in a new line in the set attributes dialog box. This works fine and my XML looks like this<br /><br /><para CMS = "prodA prodB"><br /><br />having set the two string values "prodA" and "prodB".<br /><br />But how to filter these attributes? The filter CMS="prodA" shows my paragraph correctly, but CMS="prodB" does not show this paragraph as it should. Filters seem to match only the first of the set of string values.<br /><br />I would like to show this paragraph in two document versions for these two products prodA and prodB.<br /><br />Framemaker 8.0.3<br /><br />Tilman

    Tilman,
    this is something that AFAIK is not supported by FrameMaker's own attribute based filtering.
    But, without changing your documents, if you install the *free* ABCM (Attribute-based condition management) plug-in from weststreet consulting, you will succeed. Be sure to read the tutorial!
    http://weststreetconsulting.com/
    - Michael

  • How to build a array with high sampling rates 1K

    Hi All:
    Now I am trying to develop a project with CRio.
    But I am not sure how to build a array with high sampling rates signal, like >1K. (Sigle-point data)
    Before, I would like to use "Build Arrary" and "Shift Register" to build a arrary, but I found it is not working for high sampling rates.
    Is there anyother good way to build a data arrary for high sampling rates??
    Thanks
    Attachments:
    Building_Array_high_rates.JPG ‏120 KB

    Can't give a sample of the FPGA right now but here is a sample bit of RT code I recently used. I am acquiring data at 51,200 samples every second. I put the data in a FIFO on the FPGA side, then I read from that FIFO on the RT side and insert the data into a pre-initialized array using "Replace Array subset" NOT "Insert into array". I keep a count of the data I have read/inserted, and once I am at 51,200 samples, I know I have 1 full second of data. At this point, I add it to a queue which sends it to another loop to be processed. Also, I don't use the new index terminal in my subVI because I know I am always adding 6400 elements so I can just multiply my counter by 6400, but if you use the method described further down below , you will want to use the "new index" to return a value because you may not always read the same number of elements using that method.
    The reason I use a timeout of 0 and a wait until next ms multiple is because if you use a timeout wired to the FIFO read node, it spins a loop in the background that polls for data, which rails your processor. Depending on what type of acquisition you are doing, you can also use the method of reading 0 elements, then using the "elements remaining" variable, to wire up another node as is shown below. This was not an option for me because of my programs architecture and needing chunks of 1 second data. Had I used this method it would have overcomplicated things if I read more elements then I had available in my 51,200 buffer.
    Let me knwo if you have more qeustions
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    RT.PNG ‏36 KB
    FIFO read.PNG ‏4 KB

  • How to populate an array with random text files.

    I am making a Jeopardy program. I have my program set up so that it retrieves 5 random text files. I just want to know how I populate one array with all the lines from the text files my program is retrieving.

    You can read a textfile line by line and add each line to an ArrayList. An ArrayList is very much like an array only that it's "open ended". You can start adding lines without first knowing how many you're going to get. If you still want an ordinary "static" array when you're finished reading lines you can easily get one from the ArrayList and then drop the ArrayList.

  • How to create 2D array with 3 rows and unlimit column?

    how to create 2D array with 3 rows and unlimit column?

    Here are images of what I described in my previous post
    Message Edited by JoeLabView on 11-14-2007 07:56 AM
    Attachments:
    2D-array_code.PNG ‏7 KB
    2D-array_values.PNG ‏13 KB

  • How could I delete files with name string with "TAL" and older than 05.05.

    How could I delete files with name string with "TAL" and older than 05.05.2009 on unix

    Our ECC Ides system today was not responsible. For first time 17 users were working on the systtem (IWN2008/SQL2005 based). Before the people were maximally 5.
    The server is done by making a homogeneous system copy from an blade machine(now it is an VIrTUAL)
    There was enaught disk space. However I checked Wokload 03sdn transaction) inn system. and found out that at that time of restarting(I had to restart system 3 times to get logged on the system and even then it was almost unresponsive.
    I can found in there top abap."Login_Pw", "SESSION_MANAGER", "?". (BAtch), "ADMSBUF, >DEleyed Function call, RSPOWPOO""RSWWclear", ""VA01", "SAPMHHTP  "Buf  Sync" >DDLOC CLEANUP)""rsbtctE"
    What can I do?
    ¸
    Who could interfer SAP_CCMS_MONI_BATCH_DPSAP_CCMS_MONI_BATCH_DP
    the 2 main users under users profile were ZUGTIN running and SAPSYS( running many system jobs)
    How to approach the problem

  • How to use execute immediate for character string value 300

    how to use execute immediate for character string value > 300 , the parameter for this would be passed.
    Case 1: When length = 300
    declare
    str1 varchar2(20) := 'select * from dual';
    str2 varchar2(20) := ' union ';
    result varchar2(300);
    begin
    result := str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || ' ';
    dbms_output.put_line('length : '|| length(result));
    execute immediate result;
    end;
    /SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
    length : 300
    PL/SQL procedure successfully completed.
    Case 2: When length > 300 ( 301)
    SQL> set serveroutput on size 2000;
    declare
    str1 varchar2(20) := 'select * from dual';
    str2 varchar2(20) := ' union ';
    result varchar2(300);
    begin
    result := str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || str2 ||
    str1 || ' ';
    dbms_output.put_line('length : '|| length(result));
    execute immediate result;
    end;
    /SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 6

    result varchar2(300);Answer shouldn't be here ? In the greater variable ?
    Nicolas.

  • How to fill an array with random numbers

    Can anybody tell me how I can fill an array with thousand random numbers between 0 and 10000?

    import java.util.Random;
    class random
         static int[] bull(int size) {
              int[] numbers = new int[size];
              Random select = new Random();
              for(int i=0;i<numbers.length;i++) {
    harris:
    for(;;) {
    int trelos=select.nextInt(10000);
    numbers=trelos;
                        for(int j=0;j<i;j++) {
    if(trelos==numbers[j])
    continue harris;
    numbers[i]=trelos;
    break;
    return numbers;
    /*This method fills an array with numbers and there is no possibility two numbers to be the
         same*/
    /*The following method is a simpler method,but it is possible two numbers to be the same*/
    static int[] bull2(int size) {
         int[] numbers = new int[size];
    Random select = new Random();
    for(int i=0;i<numbers.length;i++)
              numbers[i]=select.nextInt(9);
              return numbers;
         public static void main(String[] args) {
    int[] nikos = random.bull(10);
    int[] nikos2 = random.bull2(10);
    for(int i=0;i<nikos.length;i++)
    System.out.println(nikos[i]);
    for(int i=0;i<nikos2.length;i++)
    System.out.println(nikos2[i]);

  • How to build a array with collected data

    Hi,
    I have collected data from serial port with VISA. Now I want to build a array with 100 date points. Should I connect VISA Read with Build Array directly? How to do it?
    PS: All of them are in a While Structure.
    Thank you!

    An inefficient way to create the array is to use the build array and a shift register as shown below. It's more effecient in terms of memory management to create the array and then use the replace array subset as shown in the other image. Of course, if you don't need the array inside the loop, just wire the value out of the while loop and on the exit tunnel, right click and select 'Enable Indexing'.
    Message Edited by Dennis Knutson on 07-03-2007 10:25 PM
    Message Edited by Dennis Knutson on 07-03-2007 10:26 PM
    Attachments:
    Crude Build Array.PNG ‏4 KB
    Better Build Array.PNG ‏6 KB

  • How to create a array with variables dimensions?

    I try to create a array like that:
    Object[][] data;
    data = new Object[] [];
    But that's doesn't work!
    Apparently I must specify the dimension of my array
    So I have done like that :
    Object[][] data;
    data = new Object[3] [3];
    And that work!
    But the problem is when I need to add extra elements to my array.
    If I write :
    data[4][1] = "123";
    I have the error message :
    java.lang.ArrayIndexOutOfBoundsException
    So, how can I defined a array with variables dimensions OR how can I add a dimension to a array?

    if you have:
    Object[][] data;
    data = new Object[3] [3];you end yo getting ArrayIndexOutOfBoundException if you try to point to some other Indexes. You can increase the size by doing new:
    Object[][] data;
    data = new Object[4] [3];and then copy the old Arrays to this one... this is heavy.
    Other thing to consider then is using some other datastructure, such as Vector, which grows along you add elements to it.
    P_trg

  • How to traverse an array with a for-loop in this certain way...

    so I need to traverse an array starting from the first element, then from the last element, then the second element, then the second last element, then third element and so on... in a for loop
    how would that look in code?
    Any help would be appreciated, thanks!
    Edited by: inspiredone on Apr 4, 2008 6:34 AM

    Wow, that's a really clever and elegant way to do it promethuzz. I actually came up with something already before I read your post so yeah don't worry about me copying or anything. Mine is not as elegant/efficient and I definitely like yours a lot more but I will just share it anyway...it looks pretty similar to the second algorithm The_Matrix has provided. I figured this out from thinking how quicksort compares its pivot with the two indexes...
        int front=0;
        int back = a.length - 1;
        int counter =0;
        boolean switchflag = true;
        while(front<=back)
          System.out.println(a[counter]);
          if(switchflag)
            counter = back;
            front++;
            switchflag = false;
          else
            counter = front;
            back--;
            switchflag = true;
        } Anyways, thanks a lot for you guys help, promethuzz, The_Matrix, and newark.
    Edited by: inspiredone on Apr 4, 2008 11:25 AM
    Edited by: inspiredone on Apr 4, 2008 11:27 AM

  • Arrays with a string index

    Hi, I am looking for the best way to map a value to a string in an array.
    In PHP this is easy because it supports arrays with string Indexes. For example:
    $array['Canada'] = 5;
    $array['USA'] = 3;
    In Java I can't do this because I can only use an integer to index an array.
    My current solution is to create a two dimensional array:
    array[0][0] = "Canada";
    array[0][1] = 5;
    array[0][0] = "USA";
    array[0][1] = 3;
    I am wondering if there is something better.

    It creates 20 slots for reference variables that can point to Date objects. The references variables are all initialized to null.
    If you do dates[0] = new Date();, that creates a new Date object and points the reference variable in slot 0 at it.
    Date[] dates = new Date[3]; creates 3 slots--0, 1, 2.
    Edited by: jverd on Nov 8, 2007 7:39 PM

  • How to compare 2 arrays with different operator options using parameters in Teststand

    Pls let me know how to compare 2 arrays using different operators like <= or >= or ==......

     I am using TS 2010. FYI
    ex:
    Array XX [ A_Temp,
                   B_Temp,
                   C_Oil Pressure,
                   D_Oilpressure,
    Note : A_Temp, B_Temp,C_Oil Pressure,D_Oilpressure all these parameters will be getting  numerical values (dynamically) from the simulink models and also in future I may need to add parameters to this array.
    Array YY [A_Temp_1,
                   B_Temp_2,
                   C_Oil Pressure_3,
                   D_Oilpressure_4,
    Note : A_Temp_1, B_Temp_2,C_Oil Pressure_3,D_Oilpressure_4 all these parameters will be getting  numerical values (dynamically) from the simulink models
    So my question :
    I would like to verify A_Temp >= A_Temp_1
                                B_Temp >= B_Temp_2
                                C_Oil Pressure  >= C_Oil Pressure_3  etc

  • How to get the array with in the array in plsql?

    Hi,
    I have a table contains the data like below strcture.
    LINE_NUMBER     TAG_NUMBER     NOTES     TORQUE_1     TORQUE_2     TORQUE_3
    1          SSS          SUCCESS     2000          3000          4000
    1          SSS          SUCCESS     4000          5000          6000
    1          SSS          SUCCESS     7000          4000          8000
    2          YYY          FAIL     200          300          400
    2          YYY          FAIL     400          500          600
    2          YYY          FAIL     700          400          800From the above table data line_number, tag_number and notes are the commom values for the particular line number. If you see the line number 1, we have three records torque values with different torque values for one line number. Now i have to create a stored procedure to store the line_number, tag_number and notes in one array then remaining torque column for another array. The output should be the below. The output will be for line number 1 is for array1 and remaining torque values for that lin number is another array2. The same line number 2 is will come in array1 and torque information of line number 2 is for another array2. This will be structure.
    Array_1 Count :2
    Array_2 Count :6
    1: LINE_NUMBER: 1: TAG_NUMBER: SSS, NOTES: SUCCESS
    1: TORQUE_1:2000, TORQUE_2:3000, TORQUE_3:4000
    2: TORQUE_1:4000, TORQUE_2:5000, TORQUE_3:6000
    3: TORQUE_1:7000, TORQUE_2:4000, TORQUE_3:8000
    2: LINE_NUMBER: 2: TAG_NUMBER: YYY, CUST_NUMBER: FAIL
    1: TORQUE_1:200, TORQUE_2:300, TORQUE_3:400
    2: TORQUE_1:400, TORQUE_2:500, TORQUE_3:600
    3: TORQUE_1:700, TORQUE_2:400, TORQUE_3:800Can anyone share with your thoughts?
    Thanks
    Edited by: orasuriya on Jul 10, 2009 10:33 AM

    Not sure why you need pl/sql
    WITH YOUR_TABLE AS
    SELECT 1 LINE_NUMBER, 'SSS' TAG_NUMBER, 'SUCCESS' NOTES, 2000 TORQUE_1, 3000 TORQUE_2, 4000 TORQUE_3 FROM DUAL
    UNION ALL
    SELECT 1,'SSS','SUCCESS',4000,5000,6000 FROM DUAL
    UNION ALL
    SELECT 1,'SSS','SUCCESS',7000,4000,8000 FROM DUAL
    UNION ALL
    SELECT 2,'YYY','FAIL',200,300,400 FROM DUAL
    UNION ALL
    SELECT 2,'YYY','FAIL',400,500,600 FROM DUAL
    UNION ALL
    SELECT 2,'YYY','FAIL',700,4000,800 FROM DUAL
    SELECT     DECODE (rn, 0, line_number, rn) || ':',
               col_val3,
               col_val2,
               col_val3
    FROM       (SELECT   0 rn,
                         line_number,
                         tag_number,
                         notes,
                         'LINE_NUMBER:' || line_number col_val1,
                         'TAG_NUMBER:' || tag_number col_val2,
                         'NOTES:' || notes col_val3
                FROM     your_table
                UNION
                SELECT   ROW_NUMBER ()
                           OVER (PARTITION BY line_number, tag_number, notes
                                 ORDER BY ROWNUM
                         line_number,
                         tag_number,
                         notes,
                         'TORQUE_1:' || torque_1,
                         'TORQUE_2:' || torque_2,
                         'TORQUE_3:' || torque_3
                FROM     your_table)
    ORDER BY   line_number, tag_number, notes, rn

  • How to initialize the array with object?

    Here is type I have.
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_TYPE AS OBJECT
    BU_AP VARCHAR2(5),
    VOUCHER VARCHAR2(10),
    V_LINE INTEGER,
    USERID VARCHAR2(20),
    COMMENT_DTTM DATE,
    COMMENT VARCHAR2(254)
    CREATE OR REPLACE TYPE SYSADM.AP_COMMENT_COLL AS VARRAY(1000) OF SYSADM.AP_COMMENT_TYPE;
    Then I created a procedure to grab some data.
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed
    FROM ps_fas_ap_comment
    WHERE business_unit = voucher_comment (i).bu_ap
    AND voucher_id = voucher_comment (i).voucher
    AND voucher_line_num = voucher_comment (i).v_line;
    BEGIN
    voucher_comment (1) := ap_comment_type (' ', ' ', 0, ' ', '', ' ');
    --voucher_comment (1) := ap_comment_type (null, null, null, null, null,null);
    IF voucher_comment (i).v_line = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.EXTEND;
    voucher_comment (i) :=
    ap_comment_type (v_bu_in,
    v_voucher_in,
    v_line_num,
    v_userid,
    TO_DATE (TO_CHAR (SYSDATE,
    'DD-MON-YYYY HH24:MI:SS'
    'DD-MON-YYYY HH24:MI:SS'
    v_comments
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;
    But when I tried to test the procedure, got error: ORA-06531: Reference to uninitialized collection. Does anyone have experience of handling array with object?
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL;
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 1, 'KEHE', O_voucher_comment);
    end;

    Thanks for that. I changed it a little bit, but when i ran this script, got ORA-06532: Subscript outside of limit.
    declare
    O_voucher_comment SYSADM.AP_COMMENT_COLL := sysadm.ap_comment_coll(null);
    begin
    FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 0, 'KEHE', O_voucher_comment);
    end;
    PROCEDURE get_voucher_comments (
    v_bu_in IN VARCHAR2,
    v_voucher_in IN VARCHAR2,
    v_line_in IN NUMBER,
    v_userid IN VARCHAR2,
    voucher_comment OUT      sysadm.ap_comment_coll
    IS
    i NUMBER := 1;
    v_comments VARCHAR2 (254) := ' ';
    comment_type sysadm.ap_comment_type;
    v_line_num NUMBER := 0;
    CURSOR get_all_comment
    IS
    SELECT voucher_line_num, descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in;
    CURSOR get_line_comment
    IS
    SELECT descr254_mixed FROM ps_fas_ap_comment
    WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in
    AND voucher_line_num = v_line_in;
    BEGIN
    --voucher_comment() := SYSADM.ap_comment_type (NULL, NULL, NULL, NULL, NULL, NULL);
    --' ', ' ', 0, ' ', '', ' ' sysadm.ap_comment_coll
    voucher_comment := sysadm.ap_comment_coll(null);
    IF v_line_in = 0
    THEN
    OPEN get_all_comment;
    LOOP
    FETCH get_all_comment
    INTO v_line_num, v_comments;
              if i > 1
              then
                   voucher_comment.EXTEND;
              end if;
    voucher_comment (i) := ap_comment_type (v_bu_in,
    v_voucher_in, v_line_num, v_userid,
    TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS'), v_comments );
    i := i + 1;
    END LOOP;
    ELSE
    OPEN get_line_comment;
    LOOP
    FETCH get_line_comment
    INTO v_comments;
              voucher_comment.extend(6);
    voucher_comment (i) := ap_comment_type (v_bu_in, v_voucher_in, v_line_num, v_userid, TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS' ), 'DD-MON-YYYY HH24:MI:SS'), v_comments);
    i := i + 1;
    END LOOP;
    END IF;
    END get_voucher_comments;

Maybe you are looking for

  • Problem with HP Printer Sharing?

    I have an HP laserjet 1022 printer that has always worked shared. It's connected to my iMac via usb, and I have always been able to print to it with printer sharing. A few weeks ago however, the print sharing with my macmini and macbook wasn't workin

  • How can I delete captions from a group of photos? Aperture 3.3

    Is it possible to do it after having selected them all? I have 600 of them and I wouldn't like to do it one by one... Is that possible? Luca

  • Weird problem - Custom Tags

    Hello, I'm having a strange problem with my app. I've developed a custom tag and placed it on one of my xhtml files, but it never gets interpreted, no error messages, nothing. When i check the source code i see the tag exactly as i wrote it. Does any

  • I've got no internal hard disk?! Help!!

    I've got a major problem with my eMac. When i switched it on, it gives me the flashing folder symbol indicating that my computer can't find the system. I put in my Panther disks, and when it comes to installing panther, it cannot find the hard disk a

  • Drag and Drop Objects in Applet

    Is it possible to select and Drag & Drop Graphical Objects from One Applet in one Browser window to Applet in another Browser window? Thanks, Vattikuti