comma delimeted string manipulation

Three possibilities of decoding where it goes. BB SDK 5. Data GPS are stored in a vector of singleton in the form of a string. Essentially the string looks like this: value1, value2, value3, value4, Value5, Value6,

There can be more than 1 string in the singleton at some point I want to get a timer task in another thread is so to check each string, divide the data into other variables so that I can create a message that will be sent via an http connection. Bit, I'm glued to the minute tire data back to specific variables... I try to use a cup of the version of http://supportforums.blackberry.com/t5/Java-Development/String-Manipulation-split-replace-replaceAll... because I already know what will be the delimiter and also the amount of the values contained in the string, but I must be missing something here. The code that I need to check the vector and to try and do things variable is therefore:

for (int i = 0; i)< instance.vector.size();="">
{
String elementReturnString = instance.vector.elementAt (i) m:System.NET.SocketAddress.ToString ();
String strDelimeter = "";
String results [] = new String [6];
int iOccurrences = 0;
int iIndexOfInnerString = 0;
int iIndexOfDelimiter = 0;
int iCounter = 0;
                       
System.out.println ("string delimiter =" + strDelimeter); It appears,
                        
While ((iIndexOfDelimiter = elementReturnString.indexOf (strDelimiter, iIndexOfInnerString))! = - 1).
{
results [iCounter] = elementReturnString.substring (iIndexOfInnerString, iIndexOfDelimiter);
iIndexOfInnerString = iIndexOfDelimiter + strDelimiter.length ();
iCounter += 1;
}
System.out.println ("# latitude =" + results [0]);  It's never far

Lat string results = (0);

Lon string = results [1];

Line speed = results [2];
etc etc etc.

}

He bombed in the debugger with a number of errors with the first course cannot find symbol on the strDelimeter on while the statement variable. It fails every other time its use, but it displays a comma in the system.out statement. He also says that iIndexOfInnerString = iIndexOfDelimiter + strDelimiter.length (); Cannot be applied to strDelimeter.length.

..... Any ideas please? I tested that he can see in the vector information ok.

You wrote your variable strDelimeter and strDelimiter (note the an i e).

Tags: BlackBerry Developers

Similar Questions

  • Combine several values of rank in a line like comma delimeted string

    Hello

    I have a requirement to combine several values of rank in a line as the comma delimeted string as below

    INDEX_NAME COLUMN_NAME POSITION_COLONNE
    EMP_EMAIL_UK EMAIL 1
    EMP_EMP_ID_PK EMPLOYE_ID 1
    EMP_DEPARTMENT_IX DEPARTMENT_ID 1
    JOB_ID EMP_JOB_IX 1
    EMP_MANAGER_IX MANAGER_ID 1
    EMP_NAME_IX LAST_NAME 1
    EMP_NAME_IX FIRST_NAME 2
    I write in a SQL and the output I need is, for example EMP_NAME_IX LAST_NAME, FIRST_NAME.

    I can't write any function as well.

    http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php

    SELECT index_name,
           ltrim(sys_Connect_by_path(column_name, ','), ',') column_names
      FROM (select index_name,
                   column_name,
                   row_number() over(partition by index_name order by column_position) rn
              from all_ind_columns
             WHERE table_owner = 'HR')
     WHERE connect_by_isleaf = 1
     START WITH rn = 1
    CONNECT BY PRIOR rn = rn - 1
           and prior index_name = index_name
    
  • comma-separated string

    I have a string that comes an external instrument. When it is read, he appears in a format like this:

    "10,55.

    11.25

    13.43

    15.68 "

    The number of entries varies. I need to get this string in a comma-separated string that is later concatenated with another string and written to a csv file.

    So how do the entry above into this: ' 10,55, 11.25, 13.43 15.68?

    Thank you

    There are a lot of ways. I use find and replace. See attachemt for an example.

  • Adding zero in comma separated string

    Hi all

    Currently I am working on Oracle 11 g

    I have the string as 1,12,123,1234 and my requirement is to fill the zero on every comma separated string

    My output result should be like this 0001,0012,0123,1234, what exactly does lpad('12',4,'0').

    Kindly help a query above.

    A simple trick I learned for a long time back here

    SQL> with t
      2  as
      3  (
      4  select '1,12,123,1234' str from dual
      5  )
      6  select regexp_replace(regexp_replace(str, '([[:digit:]]+)', '0000\1'), '0+([[:digit:]]{4})', '\1') str
      7    from t;
    
    STR
    -------------------
    0001,0012,0123,1234
    
    SQL>
    
  • How to use String Manipulation Cloud Connector to shoot the first five characters of the field? (Expression syntax experience)

    The question

    I need to segment data on a large number of Postal Codes, usually about 400 to 600 at the same time. It is that our postcode field includes the last four digits in some cases, for example 92101-1957. When you use the Contact filter 'Value In A' I'm not able to do this 92101 *, 92102 * and of course I can't account for any combination of four numbers that might appear.

    The Solution - in theory

    The solution I came up with that is to create a new field of Contact in Eloqua 'Segmentation Zip Code' copy of the 5 digits of the postal Code field and execute segmentation using this new field.

    The Solution - Cloud Connector

    String Manipulation cloud connector must be able to perform this action - copy on the first 5 digits of the zip in the zip segment field field.

    When I'm stuck - via cloud connector

    I can't figure out how to write the syntax for expressions to search and replace. I have read the instructions of syntax and am still unable to establish exactly what I enter in the "regex to find: ' and the ' Regular Expressions to replace:

    Does anyone have expierence with an Expression syntax that might help train these expressions?

    Any ideas on other ways to address the problem would be too great.

    Thank you

    Louis

    Hi Louis,.

    Okay, I think I might know how to do it now but don't have access to Eloqua for the moment, so I'm kind of make this Store, but try below.

    Use the regex below in the "Regex for find" and let the "Regex to replace white": "."

    -(.*)$

    This will be after the hyphen and the replacement string will be empty, so I hope you should be left with just the first five digits that you can map to a new field.

    Let me know how you get on, I might be able to test myself so tomorrow so I'll see if I can make it work.

    Chris

  • Problem of string manipulation

    Hello

    I have a problem with string manipulation. I need to compare the character with his next character.
    as an example consider the string as "fat".
    'b' must be compared with 'o'.
    "o" by 'l' and so on.
    I used below the code snippet.


    for (int i = 0; i < s.length (); i ++)
    {
    int j = i + 1;
    If (s.charAt (i) == s.charAt (j))
    {
    status = false;
    }

    on the other
    {
    status = true;
    }
    }

    But I get an error message. Help, please. Thanks in advance.

    Published by: Vinayjgeorge on June 1, 2011 12:26 AM

    Published by: Vinayjgeorge on June 1, 2011 12:39 AM

    (1) for the validation of code, use the code tags so that it will be readable: http://forums.oracle.com/forums/ann.jspa?annID=1429

    (2) "I get an error" means nothing. Do you think that there is only a single possible error that may appear in the Java code and the only possible thing that can? If this isn't the case - in other words, if you don't know that there are different errors and causes - so why you thought that simply say "I get an error" without any details would be sufficient to describe the error? You must copy and paste the exact, complete error message, if you want to communicate clearly what problem you encounter so that people can help you.

    Please put a little more thought in upcoming posts.

    That said, in this case, it is easy to see an error you will get. Loop tells you ' for each character in the string, compare this character with the next. " You can see why it does not work? When you get to the last character, the comparing it to that is not possible, because there is not a next. You say "for all characters except for the last, compare it to the following."

    Once correct you that, you always seem to have a logic error. You are just blindly setting status to each character, so when you're done, just status will contain everything that produced the last comparison. It might go back between true and false to each character, but the only one that will count will be the last.

    Edited by: jverd May 31, 2011 12:06

  • How to remove duplicates from comma separated string


    Hi all

    I have an obligation to remove duplicates of string separated by commas:

    Some examples of code (real data can be in millions)

    {code}

    create table test_dup_del (num number (10), dup_val varchar2 (100));

    insert into test_dup_del values (1234, '1, 2, 3, 4, 3, 1');
    insert into test_dup_del values (4567,'1, 2, 2, 4, 4, 1');
    insert into test_dup_del values (7894,'1, 2, 1, 3, 3, 1');
    insert into test_dup_del values (1478, '1, 2, 4, 4, 3, 2');
    insert into test_dup_del values (2589, '1, 2, 1, 2, 1, 2');
    commit;

    (code}

    my output would be:

    1234, 1, 2, 3, 4'

    4567, '1, 2, 4'

    7894, '1, 2, 3'

    1478, 1, 2, 3, 4'

    2589, 1, 2'

    Thank you

    Rachid

    If there is a real need to split the data so that it could be corrected (before split to store correctly... Tip tip!) ...

    SQL > ed
    A written file afiedt.buf

    1 with test_dup_del (num, dup_val) as)
    2 Select 1234, 1, 2, 3, 4, 3, 1' Union double all the
    3 select 4567, 1, 2, 2, 4, 4, 1' Union double all the
    4 Select 7894, 1, 2, 1, 3, 3, 1' Union double all the
    5 Select 1478, 1, 2, 4, 4, 3, 2' of all the double union
    6 select 2589, 1, 2, 1, 2, 1, 2' of the double
    7      )
    8  --
    9. end of test data
    10-
    11, split as)
    12. Select num
    13, trim (regexp_substr(dup_val,'[^,]+',1,level)) as val
    14 from test_dup_del
    15 connect by num = num prior
    16 and level<=>
    17 and prior sys_guid() is not null
    18                )
    19, dist in (select distinct)
    20                      num
    21                      ,val
    22 split
    23              )
    24 select num
    25, listagg (val, ',') within the Group (order by val) as vals
    dist 26
    27 * group by num
    SQL > /.
    NUM OF VALS
    ---------- ------------------------------
    1234 1,2,3,4
    1478 1,2,3,4
    2589 1.2
    4567 1,2,4
    7894 1,2,3

    5 selected lines.

  • Split comma delimited string CONNECT BY Clause

    Hello
    I had a problem by dividing a strings separated by commas into lines.

    I explain the following use cases:

    I have an x in table
    -> create table x (id number, int_status varchar2 (100), c_ref varchar2 (30), s_ref varchar2 (30));

    I inserted values in the table:

    insert into x (id, int_status, c_ref, s_ref) values (1, 'a1, a2, a3, a4 ', 'A',' AS');
    insert into x (id, int_status, c_ref, s_ref) values (1,'b1, b2, b3, b4 ',' B', 'BS');
    insert into x (id, int_status, c_ref, s_ref) values (1,'c1, c2, c3, c4 ", 'C', null);
    insert into x (id, int_status, cust_ref, site_ref) values (1, NULL, would be ', NULL);


    I need to split the int_status separated by commas into individual lines. This means that my result is:

    . What I need or are looking as expected result:
    -----------
    1, has, HAVE, a1
    1, has, HAVE, a2
    1, has, HAVE, a3
    1, has, HAVE, a4
    1, B, BS, b1
    1, B, BS, b2
    1, B, BS, b3
    1, B, BS, b4
    C, 1, null, c1
    C, 1, null, c2
    C, 1, null, c3
    C, 1, null, c4

    I currently have a solution using Regex. But this solution uses the UNIQUE keyword.

    The solution that I currently have:

    Select UNIQUE c_ref, s_ref, regexp_substr (int_status, "[^,] +', 1, level") error_code
    x
    connect regexp_substr (int_status, "[^,] +', 1, level") is not null;


    I need a better solution. Pointers?

    Thank you
    Cherif

    Hi Omar,.

    I mentioned the solution of Odie for similar problem some time ago...
    and in my opinion the easiest to solve your task would be:

    SELECT id,c_ref,s_ref,str error_code
      FROM x_imp,
           XMLTABLE ('ora:tokenize($v, ",")'
                     PASSING int_status AS "v"
                     COLUMNS str VARCHAR2 (12) PATH '.');
    

    output:

    ID     C_REF     S_REF     ERROR_CODE
    1     A     AS     a1
    1     A     AS     a2
    1     A     AS     a3
    1     A     AS     a4
    1     B     BS     b1
    1     B     BS     b2
    1     B     BS     b3
    1     B     BS     b4
    1     C          c1
    1     C          c2
    1     C          c3
    1     C          c4
    

    See you soon,.
    Manik.

  • How to train a xml using a comma separated string in Xquery

    Hi all

    In my application, I need to write an Xquery query that should be an xml document. Admission to the XQuery function is an xml with an element that has the strings separated by commas. For

    example of

    < root >
    < StringComma > Hi, Hello, welcome < / StringComma >
    < / root >

    I need form an xml in such a way that it should have as many tags as the strings in < StringComma > element of the foregoing. For example, is what I want

    < Root1 >
    < String1 > Hello < / String1 >
    < String2 > Hello < / String2 >
    Welcome < String3 > < / String3 >
    < / Root1 >

    something like that. How could we do it using XQuery. Kindly help me in this.


    Thank you.

    Hello

    You can do it like this:

    declare variable $input := document{ Hi,Hello,Welcome };
    
    
    {
      for $i at $pos in fn:tokenize($input/Root/StringComma, ",")
      return element {fn:concat("String", $pos)} {$i}
    }
    
    
  • SQL and the Q Q string manipulation

    I'm trying to find out if I can use the manipulation of SQL strings in a Q Q. Here is an example of what I'm trying to do:

    < cfquery dbtype = "query" name = "supportstatements_order" >
    Select *, right (SupportStatements.Name, 12) as short_name
    Of SupportStatements
    Order by name
    < / cfquery >

    I get an error in CF I have an incorrect select statement.

    Is it possible to do with Q of Q?

    Thank you very much.

    Anyone know if I could use queryaddcolumn in this situation?

    Gather your themes led to the next suggestion

    Erratum edit: data type correct varchar added

  • Values separated by a nested as comma from string table

    I would insert the contents of a table nested in the form of comma-separated values in a string.


    For example, I created:

    CREATE TYPE u_results AS TABLE OF VARCHAR2 (10);
    /

    CREATE TABLE example_table)
    number of obj_id,
    obj_results u_results)
    NESTED TABLE obj_results STORE AS obj_results_t;

    INSERT INTO example_table (obj_id, obj_results) VALUES (1, u_results ('OK', 'NOK', 'NN'));
    INSERT INTO example_table (obj_id, obj_results) VALUES (2, u_results ('OK', 'NOK'));

    CREATE TABLE example_table2)
    number of obj_id,
    obj_results2 VARCHAR2 (100));

    So, in the example_table2 table I would have obj_results values in obj_results2 as string separated by commas.

    for example
    OBJ_ID obj_results2
    1 OK, NOK, NN
    2 OK, NOK

    Any ideas? Thank you
    G.
    SQL>  create type u_results as table of varchar2 (10);
    /
    Type created.
    
    SQL>  select rtrim (xmlagg (xmlelement (e, column_value || ',')).extract ('//text()'), ',') csv
          from table (u_results ('AA', 'BB')) t
    /
    CSV
    ----------
    AA,BB
    1 row selected.
    
    SQL>  drop type u_results
    /
    Type dropped.
    
  • string manipulation

    I'm working my way with the homework, and I was searching the Internet about the concatening of the word into two substrings. However, how can I say it so that he knows what he he always separates 50%? Which means half of the word goes into 1 indicator and the other half goes in the indicator 2. For now, I have to manually set the number, but it won't work if I type in another word, of course.

    PackersFan wrote:

    As said altenbach, note that it worked well with a string with a length of.  If the length is odd, you will need to turn and have uneven substrings.

    You don't want to use the simple fracture operation, because it will give an orange output. Use the quotient and remainder keep permanently blue.

    • To round down, use the output of the floor
    • To complete, add the rest to the floor exit (if the division by a number greater than two, apply the sign function to the rest first)
  • String manipulation &amp; table

    Hello

    Maybe someone can give some advice. I read the data on the temperature of a Hydra of 2620a Fluke. I went to work, one every few seconds the temperature reading is fast enough. The moat returns a string containing a number of temperatures for each analysis. Each test returns a string, something like + 0023.7E + 0, + 0025.6E + 0, + 0023.8E + 0...

    9 sensors are measured. For each channel, I can parse the string to a numeric string, convert it to a number and add this number to a table.

    Say that temperatures are 1,2,3,4,5. I find myself with a table 1 d, 1 2 3 4 5 1 2 3 4 5 12 3 4 5 1 2 3 4 5... write this to an LVM file results in 1 column with all these numbers.

    What I need is a number for each scan line, as follows (an additional column would be times)

    1 2 3 4 5

    1 2 3 4 5

    1 2 3 4 5

    I'm having a brain freeze and I just cannot find a way to do it.

    Also, I need to display these temperatures in a graph. If I have the temperatures in a picture, I can manipulate them and do the required calculations.

    If some has a suggestions that would be great. I'm using Labview 2012.

    Attached, is the part that needs to do this. 1,2,3,4,5 chain would be the release of the moat and would read up to the stop.

    Thanks in advance

    Arne

    And if you also want their graph, simply send them a chart:

  • SystemPrompt result text string manipulation does not: what am I doing wrong?

    I'm trying to manipulate a "collar", I get a SystemPrompt.  Here is my code:

    SystemPrompt {
        id: prompt
        title: qsTr("prompt")
        inputField.maximumLength: 16
        inputField.defaultText: prompt
        inputField.emptyText: "prompt"
        inputField.inputMode: SystemUiInputMode.NumericKeypad
        // eNum: Default = 0, Email = 1, Password = 2, Phone = 3, Pin = 4,
        //       Url = 5, Symbols = 6, NumericKeypad = 7, NumbersAndPunctuation = 8
        onFinished: {
            if (result == SystemUiResult.ConfirmButtonSelection) {
                result = inputFieldTextEntry()
                //result = result.mid(0,4) + " " + result.mid(4,4) + " " + result.mid(8,4) + " " + result.mid(12,4)
                //result = inputFieldTextEntry.mid(0,4) + " " + inputFieldTextEntry.mid(4,4) + " " + inputFieldTextEntry.mid(8,4) + " " + inputFieldTextEntry.mid(12,4)
                labelPrompt.text = result
                //labelPrompt.text = result.mid(0,4) + " " + result.mid(4,4) + " " + result.mid(8,4) + " " + result.mid(12,4)
                toast.body = "prompt result: " + result
                //toast.body = "result: " + result+ result.size // this causes the toast result.size value to be "undefined"
                toast.show()
            } // if
        } // onFinished
    } // SystemPrompt
    
    [...]
    
    attachedObjects: [
        SystemToast {
            id: toast
            onFinished: {
            }
        }
    ]
    

    I certainly made the generic object compared to my exact code names.  My problem is this: none of all the commented code works.  What I'm trying to do is to inject a space character between each 4 numbers entered via the SystemPrompt.  If I activate one of the commented lines, the soft seems to go out the onFinished SO without finishing (evidenced by the absence of toast).

    I have tried to type casting toString() here and there, but that shouldn't be necessary since QML handles type casting automatically.  I tried to add a debug string size value to my bread which gives a result 'undefined' for result.size

    Can someone indicate an error of my ways here?

    Not subst... There

    cardNumber = cardNumberTemp.substr(0, 4) + " " +
                 cardNumberTemp.substr(4, 4) + " " +
                 cardNumberTemp.substr(8, 4) + " " +
                 cardNumberTemp.substr(12, 4)
    
  • Remove duplicates of comma separated String

    Hello
    I have a column that contains the values of duplicates with separated by commas.

    Customer ID
    -----------------------------
    5,5,5,5,6,6,5,5,5,6,7,4,1,2,1,4,7,2

    I wrote this:

    Select REGEXP_REPLACE ('5, 5, 5, 5, 6, 6, 5, 5, 5, 6, 7, 4, 1, 2, 1, 4, 7, 2', ' (^ |,)([^,]*) (, \2)+','\1\2') of double;)
    ---------------------------------
    5,6,5,6,7,4,1,2,1,4,7,2

    But it eliminates only the continuous elements.
    I want to put it as:
    ---------------------
    5,6,7,4,1,2

    Help, please.
    Thank you.
    Amit

    Published by: 987565 on February 12, 2013 04:02

    Since you don't have 11 GR 2, making it a lot easier, I would use INSTR/SUBSTR to break the values, and then use START WITH / CONNECT BY to group the separate values of back together. I avoid the REGEXP stuff when I can because he uses a lot of CPU.

    WITH INDATA AS (
      select '9,9,8,8,7,7,6,6,5,5,4,4,3,3,2,2,1,1' x from dual
      union all
      select '9,9,8,8,7,7,4,4,3,3,2,2,1,1' x from dual
    ), TOKENIZED AS (
      SELECT DISTINCT A.INNUM,
      dense_rank() over(partition by innum order by b.column_value) x_rank,
      B.COLUMN_VALUE x
      FROM (select rownum innum, x from indata) a,
      table(cast(multiset(
        SELECT trim(SUBSTR(
          x,
          (case level
            when 1 then 1
            else instr(x, ',', 1, level-1) + 1
          end),
          (case instr(x, ',', 1, level)
            when 0 then 4000
            else instr(x, ',', 1, level) - 1 -
              (case level
                when 1 then 0
                else instr(x, ',', 1, level-1)
              end)
          end)
        ))
        FROM dual
        CONNECT BY level <= LENGTH(x) - LENGTH(REPLACE(x, ',', '')) + 1
      ) AS SYS.ODCIVARCHAR2LIST)) B
    )
    SELECT ltrim(sys_connect_by_path(x, ','),',') x
    FROM TOKENIZED A
    where connect_by_isleaf = 1
    START WITH X_RANK = 1
    connect by (innum, x_rank) = ((prior innum, prior x_rank + 1));
    
    X
    --------------------
    1,2,3,4,5,6,7,8,9
    1,2,3,4,7,8,9
    

    Published by: stew Ashton on February 13, 2013 15:47

Maybe you are looking for

  • How to use the Qosmio F50 Quad core HD processor in other software

    I would like learn how to use the image processor in other programs in addition to Toshiba Upconvert, transcoding, face Navigation and gesture of the functionality of the control. Someone has an idea? Thank you!

  • expllain how to re-install rtl120.bpl

    Please explain how to re-install rtl120.bpl.

  • SPA942 not visible to the network after factory reset

    Hello A while ago someone at our office a factory reset on one of our Linksys SPA942 phones.  He thought that it worked (it worked flawlessly; but our router has decreased. Great).  The sad thing is, from the factory, it did not work. The problem is

  • Help! Please, I beg you. Missing apps?

    Hello Where my apps should be I have 25 blue boxes with white border, then at the top right of the square circle a little red with a white border with what looks like a white image to an sd card. I can't delete them. Any ideas? Thanks in advance.

  • HP Envy Touch smart screen broken

    Hello Sometimes I accidentally broke the screen of my laptop. I wonder if there is a way that the screen can be replaced. I saw that it was covered by a sort of guarantee until 2015 (see link) http://h20614.www2.hp.com/ediags/gmd/ProdDetect.aspx?lc=e