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

Similar Messages

  • How to split string into element ?

    How do you split common string ??
    String dd = "aaa";
    dd.split("a");  // result ["a","a","a"]

    args[0] will not take the entire string Test Hello
    World. It will take only Test, so only one element in
    the string array.What are you talking about?
    He's running the Test program which receives two arguments:
    args[0] = "Hello"
    args[1] = "World"
    But I'm pretty sure he knew that as he lead his post with:
    "Ever have one of those Doh moments"

  • Read text from file, created string, but don't know how to split string.

    I've been busy with a little application which should be able to save a (2d) array to a text file, and open it afterwards.
    I already completed both steps, but i'm stuck at the reading part.
    I'm not familiar with the load function, so i used Datainputstream, which i've converted to a String afterwards. The systemconsole shows the correct information when I put the string to the console, but now i want to split the string.
    For example, my console writes:
    FILE CONTENT=458,304,0,345,432
    ("FILE CONTENT=" has been manually added to the system.out)
    Because im not English, and i don't know what I should search for on the web in order to find this, i've come up here and created this post.
    I've got an object array which is 2-dimensional, and now i was wondering how i could "rebuild" my array array[x][c] in which the first number of my file content should be X and the other numbers should be put in [c].
    Offcourse, the ',' should be skipped.
    I do have read things about tokenizing and so on, but i think that every single letter is read then.
    Any help would be much appreciated.

    Ok, thanks for the reply.
    I feel a bit ashamed now, because my topic title contains the function i needed...
    So, assuming that i would have
    String content = "458,304,0,345,432";i could split this and put this in an array string using a code like
    String[] arry = null;
    array = content.split("\\.");I haven't tested the code yet, cause i'll go to bed soon, but will this split all at once and put it in the array or do i have to create a loop or something ?
    And is it possible to put number one using split in the array[x][v] on the x location and the others at the [v] location ? (the first number of each five has to be added to [x] and the other 4 to [v] )
    Again thanks for your reply, cause im a bit further this way in accomplishing what i want to reach :)

  • How to Split String

    Hi,
        I have a string with fields each of length 40, I need to split it at the mutilples of 40  and put in an internal table , i.e.
    field1(40),
    field2(40),
    field3(40)
    v_str = (field1                                  field2                               field3                  ..  ).
    thanks
    points will rewarded

    DATA: s1 TYPE string,
    s2 TYPE string,
    s3 TYPE string,
    it_tab TYPE TABLE OF string,
    text = ` ur text `.
    SPLIT text AT ',' INTO: s1 s2 s3,
    TABLE it_tab.
    Regards,
    Jagadish

  • How to split string in data table row in c#

    hi,
    Binding List data in to data table,. in that table i have description column. this column data move to data table in sql server
    here we facing problem for Description column
    the description column having data is
    <div class="ExternalClassE4908D8C25DF4D1586D0A010BFBC5A53">3400</div>
    now we want only 3400 values i am using this code
    ring Descrption = rows["Description"].ToString();
    if (! string.IsNullOrEmpty(Descrption))
    char[] splitString = new char[] { '<', '>' };
    string[] parts = Descrption.Split(splitString,
    StringSplitOptions.RemoveEmptyEntries);
    // string[] Dec_1 = Dec.Split(new char[] { '<' }, StringSplitOptions.RemoveEmptyEntries);
    rows["Description"] = parts[1].ToString();

    Hope the below helps as start..Modify 
    //Option1
    Descrption = Descrption.Substring(0, Descrption.LastIndexOf("<"));
    Descrption = Descrption.Substring(Descrption.LastIndexOf(">") + 1);
    Console.WriteLine(" {0} ", Descrption);
    //Option2
    Console.WriteLine(" {0} ", Regex.Replace(Descrption, "<[^>]*>", string.Empty));
    accordingly..

  • How to split strings into columns

    Hi guys,
    I have a select like this:
    select 'testing1'||'.'||'testing2'||'.'||'testing3' from dualwhich gives me an output like this:
    testing1.testing2.testing3How can I split this into 3 columns in SQL PLUS?
    Thank you in advance

    user643734 wrote:
    Thank you guys for all your help.
    Hi,
    I tried to resolve your problem using somme functions...
    I know is a long, long story but it works.
    Regards,
    Ion--create table_pivot
    CREATE TABLE pivot_table(id VARCHAR2(1) primary key, all_concat VARCHAR2(1810));
    --add data
    insert into pivot_table (id, all_concat) values('x','12345.2829303132.234234.234234.234234');
    insert into pivot_table (id, all_concat) values('y','67890.2324252627.234234.234234.234234.332545');
    insert into pivot_table (id, all_concat) values('z','11121314.12345.234234.234234.234234.23432.32453245.345435.345435');
    insert into pivot_table (id, all_concat) values('a','151617.67890.234234.234234');
    insert into pivot_table (id, all_concat) values('b','1819202122.1112131415.234234.234234.234234.345435');
    insert into pivot_table (id, all_concat) values('c','2324252627');
    insert into pivot_table (id, all_concat) values('h','2829303132.234234.234234.234234.23432.32453245.345435.345435.4325435.345');
    insert into pivot_table (id, all_concat) values('r','');
    set termout off
    --procedures and functions to compile
    --1. Main function to format strings
    create or replace function fgetformatstring
    (v_max_rows numeric, v_crt_row varchar2, v_table_source varchar2, v_save_to_table varchar2, v_option numeric)
    return varchar2
    is
    v_crt_char      numeric:=0;
    v_pos_char      numeric:=1;
    v_count      numeric:=0;
    v_string_out varchar2(500);
    v_str_paded     varchar2(10):=',null';
    v_length_pad     numeric;
    v_diff_pad numeric;
    l_crt_row varchar2(1800);
    v_char char:=',';
    v_delimiter char:='.';
    l_save_to_table varchar2(1000);
    l_max_rows     numeric;
    begin
    l_crt_row:=replace(v_crt_row,'.' ,',');
    l_save_to_table:=v_save_to_table;
    l_max_rows:=v_max_rows;
    if v_option=0 then     --get the ',null' to paded in pivot_table     
    loop
              v_pos_char:=v_crt_char;
              v_crt_char:=instr(v_crt_row,v_char, v_crt_char+1);
              v_count:=v_count+1;
    exit when v_crt_char=0 or v_count=1000;
         end loop;
         v_string_out:=' ';
         v_count:=v_count-1;
         v_diff_pad :=l_max_rows-1-v_count;
    if v_diff_pad >0 then                    --nothing to add
         v_length_pad:=length(v_str_paded);-- (+v_char)
         v_length_pad:=v_diff_pad*v_length_pad;
         v_length_pad:=v_length_pad+1;
         v_string_out:=rpad(v_string_out,v_length_pad,v_str_paded);
    end if;
    end if;
    if v_option=1 then     --get definition of v_save_to_table
         v_count:=1;
         v_string_out:=' ';
         loop
    exit when v_count=l_max_rows+1 or v_count>=1000;
    v_length_pad:=length(v_string_out||'col'||to_char(v_count)||',');
              v_string_out:=rpad(v_string_out,v_length_pad,'col'||to_char(v_count)||',');
              v_count:=v_count+1;
         end loop;
    v_string_out:=trim(v_char from v_string_out);
              --v_string_out:='id,'||v_string_out;
              v_string_out:=v_string_out;
    end if;
    if v_option=2 then     --get position of last comma  
    loop
              v_pos_char:=v_crt_char;
              v_crt_char:=instr(v_crt_row,v_char, v_crt_char+1);
              v_count:=v_count+1;
    exit when v_crt_char=0 or v_count=1000;
         end loop;
         v_string_out:=substr(v_crt_row,1,v_pos_char-1);
    end if;
    if v_option=3 then     --get numbers of delimiters(.)
    loop
              v_pos_char:=v_crt_char;
              v_crt_char:=instr(v_crt_row,v_delimiter, v_crt_char+1);
    --dbms_output.put_line( 'Rows: ' ||v_crt_row|| ' iteration: '||v_count);
              v_count:=v_count+1;
    exit when v_crt_char=0 or v_count=1000;
         end loop;
         v_count:=v_count;
         v_string_out:=to_char(v_count);
    end if;
    if v_option=4 then     --get sql command to create v_save_to_table
         v_count:=1;
         v_string_out:=' ';
         loop
    exit when v_count=l_max_rows+1 or v_count>=1000;
    v_length_pad:=length(v_string_out||'col'||to_char(v_count)||' varchar2(40), ');
              v_string_out:=rpad(v_string_out,v_length_pad,'col'||to_char(v_count)||' varchar2(40), ');
              v_count:=v_count+1;
         end loop;
    v_string_out:=trim(' ' from v_string_out);
              v_string_out:=trim(v_char from v_string_out);
              v_string_out:='create table '|| l_save_to_table ||'('||v_string_out||')';
    end if;
    if v_option=5 then     --get numbers of delimiters(,) 
    loop
              v_pos_char:=v_crt_char;
              v_crt_char:=instr(v_crt_row,',', v_crt_char+1);
              v_count:=v_count+1;
    exit when v_crt_char=0 or v_count=1000;
         end loop;
         v_count:=v_count-1;
         v_string_out:=to_char(v_count);
    end if;
    dbms_output.put_line( 'string: ' ||v_string_out|| ' option: '||v_option);
    return v_string_out;
    end;
    --2.get max items
    create or replace function fgetmaxitems
    --get the max number of items founded in the pivot_table.all_concat
    --before change the points with comma
    return numeric
    is
    v_max                numeric:=0;
    v_field               pivot_table.all_concat%type;
    v_crt_max numeric:=0;
    v_crt_row     varchar(1000);
    cursor c1 is
    select all_concat from pivot_table;
    begin
    v_crt_max:=0;
    v_max:=0;
    open c1;
    loop
    fetch c1 into v_field;
    exit when c1%notfound;
    v_crt_row:=v_field;
    v_crt_max:=fgetformatstring(0,v_crt_row,'pivot_table','',3);
    if v_crt_max>v_max then
         v_max:=v_crt_max;
    end if;
    end loop;
    close c1;
    return v_max;
    end;
    --3. insert the rows in table_dest
    create or replace procedure pinsertrow
    v_max_rows numeric,
    v_all_concat varchar2,
    v_source_table_name varchar2,
    v_save_to_tablename varchar2
    is
    v_sql_string      varchar2(1000);
    l_all_concat     varchar2(1500);
    begin
    l_all_concat:=replace(v_all_concat,'.' ,',');
    v_sql_string:='('||l_all_concat||')';
    v_sql_string:=' insert into ' ||v_save_to_tablename
    ||' (' ||fgetformatstring(v_max_rows,l_all_concat,v_source_table_name,v_save_to_tablename,1)||')'||
    ' values'||v_sql_string ;
    execute immediate v_sql_string;
    end;
    --4.procedure to create dinamically <table_dest>
    create or replace procedure pcreatesavetable
    (v_table_source varchar2, v_save_to_table varchar2)
    is
    v_sql_string      varchar2(1000);
    already_exists exception;
    pragma exception_init(already_exists,-955);
    v_max numeric;
    begin
    --clear empty values;
    v_sql_string:='delete from ' ||v_table_source|| ' where length(all_concat)=0 or (all_concat) is null';
    execute immediate v_sql_string;
    v_sql_string:='';
    v_max:=fgetmaxitems;
         --create new table
         v_sql_string:=fgetformatstring(v_max,'all_concat', v_table_source,v_save_to_table,4);
    dbms_output.put_line( 'sql create : '|| v_sql_string);
    execute immediate v_sql_string;
    exception
         when already_exists then
    --delete old table
         v_sql_string:='drop table ' ||v_save_to_table;
         execute immediate v_sql_string;
         --create new table
         v_sql_string:=fgetformatstring(v_max,'all_concat', v_table_source,v_save_to_table,4);
    dbms_output.put_line( 'sql recreate final_table : '|| v_sql_string);
    execute immediate v_sql_string;
    end;
    --5.main procedure
    create or replace procedure pmainproc(v_save_to_table varchar2)
    is
    v_key_pivot      pivot_table.id%type;
    v_column_pivot     pivot_table.all_concat%type;
    v_max numeric;
    v_crt_row          varchar2(1600);
    cursor c2 is select y.id , y.all_concat
         from pivot_table y
    ;     --cursor upon pivot_table 
    begin
    v_max:=fgetmaxitems;
    if v_max <> 0 then
    --clear empty values;
    delete from pivot_table where length(all_concat)=0 or (all_concat) is null;
    --change all points with comma
    update
    (select x.id, x.all_concat from pivot_table x, pivot_table y where x.id=y.id) b
    set b.all_concat=replace(b.all_concat,'.', ',');
    -- padd the all_concat with ',null'
    update
    (select x.id, x.all_concat from pivot_table x, pivot_table y where x.id=y.id and
    fgetformatstring(v_max,x.all_concat,'pivot_table',v_save_to_table,5) <> v_max
    ) b
    set b.all_concat=b.all_concat || fgetformatstring(v_max,b.all_concat,'pivot_table',v_save_to_table,0);
    --remove last
    update pivot_table
    set all_concat= fgetformatstring(v_max,all_concat,'pivot_table',v_save_to_table,2)
    where fgetformatstring(v_max,all_concat,'pivot_table',v_save_to_table,5) = v_max;
    open c2;
    loop
    fetch c2 into      v_key_pivot, v_column_pivot;
    exit when c2%notfound;
    v_crt_row:=v_column_pivot;
    -- insert data in to final_table
    pinsertrow(v_max,v_crt_row,'pivot_table',v_save_to_table);
    end loop;
    close c2;
    end if;
    end;
    --create table_dest
    --the table_dest will be created automatically, so you need admin privilege to run that before compile pcreatesavetable :
    connect / as sysdba or connect system/password
    --grant create table to hr;
    --conne hr/hr;
    exec pcreatesavetable('pivot_table','table_dest');
    --add data to table_dest
    exec pmainproc('table_dest');
    set termout on
    select * from table_dest;
    Table created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    Function created.
    Function created.
    Procedure created.
    Procedure created.
    Procedure created.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 COL9 COL10
    12345 2829303132 234234 234234 234234
    67890 2324252627 234234 234234 234234 332545
    11121314 12345 234234 234234 234234 23432 32453245 345435 345435
    151617 67890 234234 234234
    1819202122 1112131415 234234 234234 234234 345435
    2324252627
    2829303132 234234 234234 234234 23432 32453245 345435 345435 4325435 345
    7 rows selected.

  • How to split string based on either space or tab delimitation?

    I'm trying to split a string into 4 fields.  The strings sometimes have space delimitation and sometimes have tab delimitation.  Is there any way to do this in a SELECT, or do I need a couple staging tables, or what?
    I'm trying to work with this.
    Select PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),4) Date,
    PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),3) ID,
    PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),2) Rank1,
    PARSENAME(replace(replace(replace(replace([Column 0],' ','<>'),'><',''),'char(9)',' '),' ','.'),1) Rank2
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    This is similar thread that someone posted a week ago
    Split delimited string into separate columns
    based on space
    My solution was, using a user defined function to split the text:
    Use Master
    Go
    CREATE FUNCTION dbo.udf_SplitString(@InputVal VARCHAR(200), @Delimiter CHAR(1))
    RETURNS @Items TABLE (RowNo TINYINT, ITEM VARCHAR(100))
    As
    BEGIN
    DECLARE @FieldLen TINYINT = 0, @FieldEnum TINYINT = 0, @TempItem VARCHAR(100) = '', @ItemLoop TINYINT = 1
    SET @FieldLen = LEN(@InputVal)
    WHILE @FieldEnum <= @FieldLen
    BEGIN
    IF (SUBSTRING(@InputVal, @FieldEnum + 1, 1) = @Delimiter OR @FieldEnum = @FieldLen) AND @TempItem <> ''
    BEGIN
    INSERT @Items (RowNo, Item)
    VALUES (@ItemLoop, LTRIM(RTRIM(@TempItem)))
    SET @TempItem = ''
    SET @ItemLoop += 1
    END
    ELSE
    BEGIN
    IF SUBSTRING(@InputVal, @FieldEnum + 1, 1) <> @Delimiter
    BEGIN
    SET @TempItem = @TempItem + SUBSTRING(@InputVal, @FieldEnum + 1, 1)
    END
    END
    SET @FieldEnum += 1
    END
    RETURN
    END
    Next, use the splited data to group based on requirements
    DECLARE @AllData TABLE
    [Column 0] VARCHAR(50)
    INSERT INTO @AllData
    VALUES('20150101 04559690 45 33')
    INSERT INTO @AllData
    VALUES('20150101 045595320 42 48')
    INSERT INTO @AllData
    VALUES('20150101 041198690 44 34')
    INSERT INTO @AllData
    VALUES('20150101 0455222130 41 49')
    INSERT INTO @AllData
    VALUES('20150101 554567450 40 51')
    ;WITH CTE
    AS
    SELECT
    ,Row_Number() OVER(PARTITION BY MainQry.[Column 0] ORDER BY MainQry.[Column 0]) As RowNo
    FROM
    @AllData As mainQry
    CROSS APPLY (SELECT Item FROM Master.dbo.udf_SplitString(REPLACE(MainQry.[Column 0], CHAR(9), ' '), ' ')) As SubQry
    SELECT
    [Column 0]
    ,MAX(CASE WHEN RowNo = 1 THEN Item ELSE '' END) AS [DATE]
    ,MAX(CASE WHEN RowNo = 2 THEN Item ELSE '' END) AS [ID]
    ,MAX(CASE WHEN RowNo = 3 THEN Item ELSE '' END) AS [Rank1]
    ,MAX(CASE WHEN RowNo = 4 THEN Item ELSE '' END) AS [Rank2]
    FROM
    CTE
    GROUP BY
    [Column 0]
    Output
    Column 0 | DATE
    | ID
    | Rank1 | Rank2
    20150101 0455222130
    41 49
    | 20150101
    | 0455222130
    | 41 | 49
    20150101 554567450
    40 51
    | 20150101
    | 554567450
    | 40 | 51
    20150101 041198690 44  34
    | 20150101
    | 041198690
    | 44 | 34
    20150101 045595320 42   48
    | 20150101
    | 045595320
    | 42 | 48
    20150101 04559690 45  33
    | 20150101
    | 04559690 | 45
    | 33
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • How to split strings in pl/sql

    PROCEDURE COLUMN_SPLIT (p_def   IN     VARCHAR2,
                                         p_sch          OUT VARCHAR2,
                                         p_table           OUT VARCHAR2,
                                         p_column          OUT VARCHAR2)
       IS
       BEGIN
          NULL;
       END;
    END;
    I want to split p_def by dots, check for 3 elements, and return them in p_sch, p_table and p_column
    for example p_sch will be like hello.howare.you.
    I want to split it to
    hello
    howare
    you
    I have very limited knowledge with pl/sql can someone point me in the right direction or maybe show some example.

    PROCEDURE COLUMN_SPLIT (p_def   IN     VARCHAR2,
                                         p_sch          OUT VARCHAR2,
                                         p_table           OUT VARCHAR2,
                                         p_column          OUT VARCHAR2)
       IS
       BEGIN
           p_sch    :=  REGEXP_SUBSTR(p_def, '[^.]+', 1, 1);
           p_table  :=  REGEXP_SUBSTR(p_def, '[^.]+', 1, 2);
           p_column := REGEXP_SUBSTR(p_def, '[^.]+', 1, 3);
       END;
    Ramin Hashimzade

  • Split String into two

    HI,
    How to Split String into two parts at delimiter

    HI,
    REPORT ZSTRING.
    DATA: LENGTH TYPE I,    
          REMAINING_LENGTH TYPE I ,   
          NEXT_POINTER TYPE I    ,   
          FIRST_HALF(20)  TYPE C ,    
          SECOND_HALF(20) TYPE C ,    
          TEMP TYPE I .
    PARAMETER: WORD(35) TYPE C . "INPUT WORD
    START-OF-SELECTION.
    LENGTH = STRLEN( WORD ).      "Length of the input String
    SEARCH WORD FOR '/'.
        IF SY-SUBRC = 0 .  
          IF SY-FDPOS > 0.   
          MOVE WORD+0(SY-FDPOS) TO FIRST_HALF.  
          ENDIF.  
       TEMP = SY-FDPOS + 1. 
       IF TEMP <> LENGTH.    
       NEXT_POINTER = SY-FDPOS + 1.    
       REMAINING_LENGTH = ( LENGTH - SY-FDPOS ) - 1.    
       MOVE WORD+NEXT_POINTER(REMAINING_LENGTH) TO SECOND_HALF.  
       ENDIF.
    ENDIF.
    WRITE:/'Input String:', WORD .
    WRITE:/'First  Half:', FIRST_HALF.
    WRITE:/'Second Half:', SECOND_HALF.
    *-- End of Program
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • How to implement String.split() on 1.3?

    Hi,
    I have a String split method which is able to be run on 1.4.
    The string "boo:and:foo", for example, yields the following results with these parameters:
    Regex Limit Result
    : 2 { "boo", "and:foo" }
    : 5 { "boo", "and", "foo" }
    : -2 { "boo", "and", "foo" }
    o 5 { "b", "", ":and:f", "", "" }
    o -2 { "b", "", ":and:f", "", "" }
    o 0 { "b", "", ":and:f" }
    The program cannot be complied if I run it on 1.3. How can I do the 1.4 split function on 1.3?
    Thanks for advice

    If you don't require the more powerful regular expression matching, you can implement the split() functionality with existing String methods.
    If you are splitting around a character, you can use StringTokenizer, unless you care about empty tokens. If you need empty tokens returned, then you can use the following method:
    public static String[] split(String input, char c) {
        int tokenCount = 0;
        int cIndex = -1;
        do {
            cIndex = input.indexOf(c, cIndex + 1);
            tokenCount++;
        } while (cIndex >= 0);
        String[] tokens = new String[tokenCount];
        int tokenIndex = 0;
        do {
            int index = input.indexOf(c, cIndex + 1);
            if (index < 0) {
                tokens[tokenIndex] = input.substring(cIndex + 1);
            else {
                tokens[tokenIndex] = input.substring(cIndex + 1, index);
            cIndex = index;
            tokenIndex++;
        } while (cIndex >= 0);
        return tokens;
    }If you need to split around a multiple character string, use the following method.
    public static String[] split(String input, String str) {
        int strLength = str.length();
        int tokenCount = 0;
        int strIndex = -strLength;
        do {
            strIndex = input.indexOf(str, strIndex + strLength);
            tokenCount++;
        } while (strIndex >= 0);
        String[] tokens = new String[tokenCount];
        int tokenIndex = 0;
        strIndex = -strLength;
        do {
            int index = input.indexOf(str, strIndex + strLength);
            if (index < 0) {
                tokens[tokenIndex] = input.substring(strIndex + strLength);
            else {
                tokens[tokenIndex] = input.substring(strIndex + strLength, index);
            strIndex = index;
            tokenIndex++;
        } while (strIndex >= 0);
        return tokens;
    }These have only been lightly tested, no guarantees.

  • How to split the string by datetime in sql

    Hi,
    How to split the string by datetime in sql, I've a table with comments column stores comments by datetime, while selecting I want to split and show as in rows by each jobref.
    can anyone help me in this please.
    Thanks,

    declare @callcentre table (comments varchar(max),lbiref varchar(200))
    insert into @callcentre
    select '(28/10/2014 14:56:14) xyz ..... call  logged   (28/10/2014 14:56:58) xyz ..... call updated   (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
    insert into @callcentre
    select '(29/10/2014 14:56:14) xyz ..... call  logged   (29/10/2014 14:56:58) xyz ..... call updated   (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
    insert into @callcentre
    select '(30/10/2014 14:56:14) xyz ..... call  logged   (30/10/2014 14:56:58) xyz ..... call updated  
    output:
    1) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910201'
     2) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910201'
    3) 28/10/2014 14:57:41,  (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910201'
    4) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910202'
     5) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910202'
    6) 28/10/2014 14:57:41,  (28/10/2014 14:57:41)xyz ..... call updated,'Vi2910202'
    7) 28/10/2014 14:56:14, (28/10/2014 14:56:14) xyz ..... call  logged ,'Vi2910203'
     8) 28/10/2014 14:56:58 ,(28/10/2014 14:56:58) xyz ..... call updated ,'Vi2910203'
    Thanks,
    See this illustration
    declare @callcentre table (comments varchar(max),lbiref varchar(200))
    insert into @callcentre
    select '(28/10/2014 14:56:14) xyz ..... call logged (28/10/2014 14:56:58) xyz ..... call updated (28/10/2014 14:57:41)xyz ..... call updated','Vi2910201'
    insert into @callcentre
    select '(29/10/2014 14:56:14) xyz ..... call logged (29/10/2014 14:56:58) xyz ..... call updated (29/10/2014 14:57:41)xyz ..... call updated','Vi2910202'
    insert into @callcentre
    select '(30/10/2014 14:56:14) xyz ..... call logged (30/10/2014 14:56:58) xyz ..... call updated','Vi2910203'
    SELECT LEFT(p.u.value('.[1]','varchar(max)'),CHARINDEX(')',p.u.value('.[1]','varchar(max)'))-1) AS [Date],
    '(' + p.u.value('.[1]','varchar(max)') AS comments,
    lbiref
    FROM
    SELECT lbiref,CAST('<Root>' + STUFF(REPLACE(comments,'(','</Data><Data>'),1,7,'') + '</Data></Root>' AS XML) AS x
    FROM @callcentre c
    )t
    CROSS APPLY x.nodes('/Root/Data')p(u)
    and the output
    Date comments lbiref
    28/10/2014 14:56:14 (28/10/2014 14:56:14) xyz ..... call logged Vi2910201
    28/10/2014 14:56:58 (28/10/2014 14:56:58) xyz ..... call updated Vi2910201
    28/10/2014 14:57:41 (28/10/2014 14:57:41)xyz ..... call updated Vi2910201
    29/10/2014 14:56:14 (29/10/2014 14:56:14) xyz ..... call logged Vi2910202
    29/10/2014 14:56:58 (29/10/2014 14:56:58) xyz ..... call updated Vi2910202
    29/10/2014 14:57:41 (29/10/2014 14:57:41)xyz ..... call updated Vi2910202
    30/10/2014 14:56:14 (30/10/2014 14:56:14) xyz ..... call logged Vi2910203
    30/10/2014 14:56:58 (30/10/2014 14:56:58) xyz ..... call updated Vi2910203
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to split a string having string as delimiter instude of char?

    Hello Gurus,
    I want to split the string and work on each split string.
    The following code will do, but not exactly.
    It's split into morethan three strings, where coma find.
    But I want to split it using #,# as delimiter.
    Here is my code:
    //File fileData = new File("myfile.txt");
    // This will have coma separated fields data
    // while traversing this file will readLine() give the string, that is strRecord
    // BufferedReader bfrdRdrObj = new BufferedReader(new FileReader(strDataFile));
    //while ((strThisLine = bfrdRdrObj.readLine()) != null) {..........
    String strRecord = #A001#,#User1#,#this is record, so need to split and place, insert into table#;
    StringTokenizer strTknRec = new StringTokenizer(strRecord,"#,#");
    int iCounter=0;
    while(strTknRec.hasMoreTokens()){
    System.out.println(++iCoutner+"Field: "+strTknRec.nextToken());
    Please, give me hint.
    Thanks in advance.
    ~ SubbaReddy .M

    Hello Guru,
    Here "myfile.txt" CSV file.
    each line represented treated as a record and coma seperated string is treated as fields.
    But, one of the fields data may have the coma in the string itself. So, # or " (double quote) has been place before and end of the field data as a string qualifier.
    //File fileData = new File("myfile.txt");
    // This will have coma separated fields data
    // while traversing this file will readLine() give the string, that is strRecord
    // BufferedReader bfrdRdrObj = new BufferedReader(new FileReader(strDataFile));
    //while ((strThisLine = bfrdRdrObj.readLine()) != null) {..........
    String strRecord = #A001#,#User1#,#this is record, so need to split and place, insert into table#;
    StringTokenizer strTknRec = new StringTokenizer(strRecord,"#,#");
    int iCounter=0;
    while(strTknRec.hasMoreTokens()){
    System.out.println(++iCoutner+"Field: "+strTknRec.nextToken());
    And I would like to run this JRE 1.3.1
    Hope, String.split() in JRE 1.4.0 beta will some what resolve this.
    But, how to do it on JRE 1.3.1
    Please, give me hint.
    Thanks in advance.

  • How To Split the String for "."

    Hi Friends
    I am Using Following Code to Split one String.
    String str = "Jeetendra.choudhary";
    String[] sp_str = str.split(".");
    wdComponentApi.getMessageManager.reportSuccess(str[0]);
    wdComponentApi.getMessageManager.reportSuccess(str[1]);
    but its throwing null pointer exception. 
    when i am using following code its working fine.
    String str = "Jeetendra/choudhary";
    String[] sp_str = str.split("/");
    wdComponentApi.getMessageManager.reportSuccess(str[0]);
    wdComponentApi.getMessageManager.reportSuccess(str[1]);
    what may be the issue and how to split the string with "." ?
    Thanks & Regards
    Jeetendra

    "." is a special character.
    Use
    str.split("\\.");
    Regards
    Benjamin
    Edited by: Benjamin Hansen on Dec 29, 2009 7:52 AM

  • How to "split" a string using API 1.3?

    Hi everyone,
    I'm needing to split strings at the slash "/" character.
    Unfortunately, we're using API 1.3, and according to the API, "split" isn't available until 1.4.
    I'm looking for suggestions, help, examples, or alternatives.
    Thanks!

    How about StringTokenizer?

  • How to split this string(char1)char2(char3)char4 into (char1)char2 , .. etc

    how to split this string (char1)char2(char3)char4 into (char1)char2 , (char3)char4?
    String[] result = "(char1)char2(char3)char4".split("\\(");I want :
    result[0] = "(char1)char2" and
    result[0] = "(char3)char4"
    acutally char1,char2,char3, char4 ... is in the form of the below.
    (any charactors except round brace)any charactors except round brace(any charactors except round brace)any charactors except round brace
    I prefer String.split and Pattern.compile().split.
    Edited by: iamjhkang on Feb 5, 2009 3:37 PM
    Edited by: iamjhkang on Feb 5, 2009 3:41 PM

    iamjhkang wrote:
    especially on
    ?= and ?<
    Thanks.The following:
    (?=...)   // positive look ahead
    (?!...)   // negative look ahead
    (?<=...)  // positive look behind
    (?<!...)  // negative look behindare all "look-arounds". See: [http://www.regular-expressions.info/lookaround.html]

Maybe you are looking for

  • Discoverer Report - Not In condition

    Hi, I am somewhat new to Discoverer but pretty computer savvy. The problem I am having revolves around the inability to display employees who do not have a certain "competency" associated with their training records. For example I will set a conditio

  • Problem in starting the weblogic 5.1 server

    I am yet to deploy the bean in the ejbdeployer. When I start it from the startup start-> programs-> weblogic 5.1-> ejbdeployer the weblogic screen opens and remain as it is. I have tried the same in d:\weblogic\bin\ejbdeployer I got a exception as ja

  • Dow to put on iTunes gift cards

    Hello it's my 40th birthday today and I got £5,000 spending money in my bank and and a new car (Renault Clio) :) I buy an iPad 3 64 giga bites and its got cellyula or something on it. But it's what all they had in stock. I set it up and it took me a

  • Retrieving column datatype n its size.

    Hi.., I have a query regarding ODI. I have a source table & one target table. I want to write data from source table to target table...but there are two more columns in target where i like to write the datatype n size of respective rows from source t

  • Syncing with IMAC via bluetooth

    I am trying to sync my iphone with my new IMAC via bluetooth. they see each other and are paired - but when I click on iSync it says it cannot connect to the device so it cannot sync. What am I missing? I checked a list of supported devices for bluet