How to split a string which contents 2byte character

hi all,
  i wanna split a string into substrings  five bits a time
the problem is the original string may contents 2byte characters
and if the split bit is a 2byte character we only take the first four bits.
the 2byte character is used for the next five bits.
  so could you tell how carry is out.
thanks in advance

hi all,
  i wanna split a string into substrings  five bits a time
the problem is the original string may contents 2byte characters
and if the split bit is a 2byte character we only take the first four bits.
the 2byte character is used for the next five bits.
  so could you tell how carry is out.
thanks in advance

Similar Messages

  • 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 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 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]

  • How to split a string into tokens and iterate through the tokens

    Guys,
    I want to split a string like 'Value1#Value2' using the delimiter #.
    I want the tokens to be populated in a array-like (or any other convenient structure) so that I can iterate through them in a stored procedure. (and not just print them out)
    I got a function on this link,
    http://www.orafaq.com/forum/t/11692/0/
    which returns a VARRAY. Can anybody help me how to iterate over the VARRAY, or suggest a different alternative to the split please ?
    Thanks.

    RTFM: http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/collections.htm#sthref1146
    or
    http://www.oracle-base.com/articles/8i/Collections8i.php

  • How to split a string with a space in between?

    Hi ABAP Guru's,
    Can you please help me out? How can I split a string into two which has a space in between?
    For example: lets suppose the string is 'LA CA USA'. How can I split this string? I have to dynamically determine the number of characters before the space therefore I cannot use number constant such as 2 or 3.
    With best regards,
    Ketan

    Hi
    Try like this
    DATA : opbal TYPE p DECIMALS 2 VALUE 0.
        SELECT * FROM zs_mkpf_mseg
                        into corresponding fields of table it_opbal
                        WHERE werks =  itmat-werks
                        AND matnr = itmat-matnr
                        AND budat = s_budat-low.
      *  sort  it_opbal by budat.
      loop at it_opbal.
    read table it_opbal.
          IF it_opbal-shkzg = 'S'.
            opbal = opbal + it_opbal-menge.
          ELSEIF it_opbal-shkzg = 'H'.
            opbal = opbal + it_opbal-menge * -1.
          ENDIF.
      endloop.
        append opbal TO itab-opbal.
      ENDFORM.                    " opbal_data
    you can also use thi s
    DATA: NAMES(30)    TYPE C VALUE 'Charly, John , Peter',
          NAMES2       TYPE STRING,
          ONE(10)      TYPE C,
          TWO(10)      TYPE C,
          THREE        TYPE STRING,
          FOUR(4)      TYPE C VALUE 'FOUR',
          DELIMITER(2) VALUE ','.
    SPLIT NAMES AT DELIMITER INTO ONE TWO.
    *     ONE contains 'Charly' and TWO contains 'John , Pet'.
    *     SY-SUBRC is 4, because TWO was not large enough to
    *     accommodate the whole of the remaining string
    SPLIT NAMES AT ',' INTO ONE TWO THREE.
    *     ONE contains 'Charly', TWO contains ' John',
    *     THREE contains ' Peter'.
    SPLIT NAMES AT ', ' INTO ONE THREE TWO.
    *     ONE contains 'Charly', THREE contains 'John',
    *     TWO contains 'Peter'.
    CONCATENATE NAMES '' INTO NAMES2 SEPARATED BY SPACE.
    SPLIT NAMES2 AT DELIMITER INTO ONE TWO THREE FOUR.
    *     ONE contains 'Charly', TWO contains 'John',
    *     THREE contains 'Peter ', FOUR is empty.
    SPLIT NAMES2 AT DELIMITER INTO ONE FOUR THREE.
    *     ONE contains 'Charly', FOUR contains 'John',
    *     THREE contains 'Peter', SY-SUBRC is 4, since
    *     FOUR was not large enough (spaces are significant
    *     characters!)
    Reward all helpfull answers
    Regards
    Pavan

  • How to read a file which content hindi characters.....

    I m reading a text file which content hindi characters.... but m nt getting the right result. It shows garbage instead of hindi characters.
    plz somebody help me....:(

    You posted this in the XML forum. Is this an XML file you are asking about?
    And we need definitions for some of the terms you used in your original post. You said "it shows garbage". We need to know:
    1. What is the "it" there?
    2. How does it "show" something?
    3. What does the "garbage" look like.
    In future you will find you get better answers if you write better questions.

  • How to split a string using IndexOf?

    How would you split a string using indexOf and not using the .split method?
    Any help is appreciated :D
    Message was edited by:
    billiejoe

    would it be better to use the first or the second?
    int      indexOf(int ch)
    Returns the index within this string of the first occurrence of the specified character.
    int      indexOf(int ch, int fromIndex)
    Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
    I think the second would be helpful. so how do i read it?

  • How to Split the string using Substr and instr using loop condition

    Hi every body,
    I have below requirement.
    I need to split the string and append with single quotes('') followed by , (comma) and reassign entire values into another variable. so that i can use it where clause of update statement
    for example I am reciveing value as follows
    ALN varchar2(2000):=(12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434);
    Note: In the above variable i see 8 transactions, where as in real scenario i donot how many transaction i may recive.
    after modification i need above transactions should in below format
    ALTR Varchar2(2000):=('12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434');
    kindly help how to use substr and instr in normal loop or for loop or while loop while modifying the above transactions.
    Please help me to sort out this issue.
    Many Thanks.
    Edited by: user627525 on Dec 15, 2011 11:49 AM

    Try this - may not be the best way but...:
    create or replace type myTableType as table of varchar2(255)
    declare
    v_array mytabletype;
    v_new_str varchar2(4000);
    function str2tbl
             (p_str   in varchar2,
              p_delim in varchar2 default '.')
             return      myTableType
        as
            l_str        long default p_str || p_delim;
             l_n        number;
             l_data     myTableType := myTabletype();
        begin
            loop
                l_n := instr( l_str, p_delim );
                exit when (nvl(l_n,0) = 0);
                l_data.extend;
                l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
                l_str := substr( l_str, l_n+length(p_delim) );
            end loop;
            return l_data;
       end;
    begin
      v_array := str2tbl ('12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434', ',');
          FOR i IN 1 .. v_array.COUNT LOOP
             v_new_str := v_new_str || ''''||v_array(i)||'''' || ',';
          END LOOP;
       dbms_output.put_line(RTRIM(v_new_str, ','));
    end;  
    OUTPUT:
    =======
    '12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434'HTH
    Edited by: user130038 on Dec 15, 2011 12:11 PM

  • How to append a string whose content is XML file to the child of other XML?

    Hi guys,
    I have a question:
    I obtain a string which is actually a response from HTTP servlet, and I want to append this string as child of another XML, how can I do it? Is there any method to convert string to XML node, opposite to the method "render_2_string"?
    Thanks in advance
    Message was edited by: Liying Wang

    If I understand your question correctly, this may be helpful.
    types: begin of myStructure,
             myNumber type n,
             myChar   type c,
           end of myStructure.
    Data:
    IXML   Type Ref To     IF_IXML,
    XMLDOC Type Ref To     IF_IXML_DOCUMENT,
    RC     Type             SY-SUBRC.
    data rootNode type ref to if_ixml_element.
    data newNode type ref to if_ixml_element.
    data sourceString type string.
    types
      ixml = cl_ixml=>create( ).
      xmlDoc = ixml->create_document( ).
      rootNode = xmlDoc->create_element( 'RootElement' ).
      setAttributesFromStructure( node = rootNode structure = 
      mystructure ).
      newNode = xmlDoc->create_element( 'newNodeAdded' ).
      if sourceString is not initial.
        rc = newNode->IF_IXML_NODE~SET_VALUE( sourceString ).
      endif.
      add navigation graph entry
        rc = rootNode->append_child( newNode ).
    Quack

  • How can i encrypt "String" which present a Password

    i have a String which present password, how can i encrypt the password while i save it to an XML file and how i decipher the password when i load it from the XML file.
    Thanks

    You don't generally encrypt passwords. You simply hash them. There should rarely, if ever, be a reason to decrypt a password.
    http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html
    http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html

  • How to split a string around "." expression

    My code is:
    public String removeExtn(String resource){
              String[] splittedName = resource.split(".");
    System.out.println("LENGHT IS: "+ splittedName.length);
              if(splittedName.length >= 3)
                   resource = splittedName[0]+ "." + splittedName[1];
              return resourceName;
         * @param args
         public static void main(String[] args) {
              Test obj = new Test();          
              System.out.println(obj.removeExtn("myfile.xml.sample"));
    But it doesn't split the string around "." and given the arraylength 0. But if I try to use any another character (e.g. "," or ";") it works perfectly fine.
    Please help me.
    Thanks in advance.
    Mansi

    Hi mansi,
    I had a same kind of problem a few days back.
    What I learned was the split() method has a string expression in it, which is usually noted as regex .
    'Regex' is just a short form for 'regular expression'
    You may directly use the string variable you would split around in some cases or may want to use a '\\' before some of the characters.
    I can't place whole information here .So, let me give you that sun site link I read it from.
    This link deals with the whole string class.
    You may want to ctrl+F and split to read on split method.
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.htmlThis link talks about the regular expressions
    http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html#sumI got his for you from that link :
    \p{Punct} Punctuation: For One of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ This is for your knowledge.
    And if you want a quick fix just for your code...
    that'ld be using a
    split(\p{.}) in place where u used a split(.)I have not tried that ...but u may want to!
    Hope that helps.
    Message was edited by:
    Kishorei20
    Message was edited by:
    Kishorei20

  • How to split this string into 4 sections to a max 35 characters

    Hello,
    Does anyone have an idea how I can acheive this please.
    I have this string
    Expense_Inv_8- ExpenseInv_7- Exp001- Expense_Inv_6- Expense_Inv_5- Expense_Inv_4- Expense_Inv_3- Expense_Inv_2- Expense_inv1
    and I need to display them in sections seperated by ';' as explained below
    Section 1 Section 2 Section 3 Section 4
    Expense_Inv_8- ExpenseInv_7- Exp001;Expense_Inv_6- Expense_Inv_5;Expense_Inv_4- Expense_Inv_3;Expense_Inv_2;
    need to split this string into 4 sections seperated by ';' and each section should be of no more than 35 characters, if null should end ;;;
    Section 1, 35 Character ended by;
    Section 2, broken off after Expense_Inv_5 because Expense_Inv_4 will take it over 35 chracters)
    Section 3, should only take Expense_Inv_4- Expense_Inv_3, because adding Expense_Inv_2 will take it over 35
    characters, each record in the string is seperated by '-'
    Section 4, dispays the reminder of the string
    regards
    Ade

    Hi,
    Welcome to the forum!
    Whenever you ask a question, it helps if you post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) and the results you want from that data.
    I think I understand the problemk well enough to attempt a solution, but if the query below isn't right, please post that information.
    WITH     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL     <= ( SELECT  MAX (LENGTH (txt))
                             FROM    table_x
    ,     got_best_path     AS
         SELECT     id
         ,     txt
         ,     MAX ( SYS_CONNECT_BY_PATH ( TO_CHAR (c.n, '99')
                      ) AS best_path
         FROM     cntr     c
         JOIN     table_x     x     ON     c.n <= LENGTH (x.txt)
         START WITH     c.n     = 1
         CONNECT BY     c.n - PRIOR c.n     BETWEEN  1
                                 AND      :section_length
              AND     x.id          = PRIOR     x.id
              AND     SUBSTR ( x.txt
                                 , c.n
                                 , 1
                                 )     = '-'
         AND     LEVEL          <= :section_cnt
         GROUP BY  id
         ,            txt
    ,     got_pos     AS
         SELECT     id
         ,     REPLACE ( txt
                   ) || ';'                         AS txt
         ,     best_path
         ,     TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 2))     AS pos_2
         ,     TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 3))     AS pos_3
         ,     TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 4))     AS pos_4
         FROM     got_best_path
    SELECT  id
    ,     SUBSTR (txt,     1    , NVL ( pos_2         , :section_length))     AS section_1
    ,     SUBSTR (txt, pos_2 + 1, NVL ((pos_3 - pos_2), :section_length))     AS section_2
    ,     SUBSTR (txt, pos_3 + 1, NVL ((pos_4 - pos_3), :section_length))     AS section_3
    ,     SUBSTR (txt, pos_4 + 1,                        :section_length )     AS section_4
    FROM     got_pos
    ;As written, this requires SQL*Plus 9 (or higher). You can have multiple versions or SQL*Plus on the same client, if you really need to keep the older version.
    :section_length is the maximum length of each section (35, as you stated the problem).
    :section_cnt is the number of sections. In the query above, this is 4. If you change it, you not only have to change the bind variable, but you have to change the hard-coded SELECT clauses of the main query and the last sub-query (that is, got_pos).
    MODEL or PL/SQL would probably be better ways to solve this problem.

  • 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 a string for 2 different matching patterns?

    hey guys
    i'm trying to split a string, using .split(regular expression), if two different pattern matches but i don't know the exact syntax for it. I want to split the string from letters and punctuations.
    This is what i'm doing, obviously it's not working, i'm not too sure if syntax are correct.
    String inputDigit [] = input.split("([a-zA-Z]) (\\p{Punct})");Please help me with this, thank you!

    Can you describe in more detail what you're trying to
    accomplish?ok, basically if you have a string which consists of letters, digits and punctuations. All i'm trying to do or want to do is store all digist within that string into an array. Therefore, i'm using split method to split the string wherever you find a letter or a punctuation. But i don't know what is syntax for using two different patterns at the same time.
    // For example if you have a string "Eeyore 61 2.986PoohPiglet007Kanga-23"
    // i only want: 61 2 986 007 23. I know i can use substring // but that would be a slightly long process

Maybe you are looking for

  • SharePoint Foundation 2013 - Search Configuration Issue - 2 App Servers and 2 Front-End Servers

    Hi,  We have a SharePoint Foundation 2013 with SP1 Environment.  In that, we have 2 Front-End Servers and 2 App Servers. In the Front-End Servers, the Search Service is stopped and is in Disabled state and in the 2 App Servers in One App Server, Sear

  • Mac will not start up! Help!!?

    Hi guys and gals - Before I reinstall my system software and lose my itunes and iphoto files I was wondering if anybody can help or has experienced the same problem as me. Here is what happened; I was about to import some pics from my camera when it

  • Migration from IAS 9i to Weblogic BEA

    Hi, I need to do a migration from IAS 9i to weblogic BEA, i need to know the compatibility problems, where I can found some documentation about it?

  • Posted new Ep., now old one's gone too

    I have a podcast hosted through Blogger.com. I posted my second episode last night, updated through the ping service, and when I checked the iTunes store page, NEITHER of the episodes are present. Any idea what's happening? My page: http://itunes.app

  • Best way to handle optional elements in XSLT

    Hi All, I'v wondering if there are any better ways to handle optional fields in XSLT. For example if my Person Type has 5 fields and 3 of them are optional: <xs:complexType name="PersonType"> <xs:element name="PersonID" min="1"/> <xs:element name="PI