Part of  string

[email protected]; [email protected],
if I only want first part of string, I meant before ;
is that split is the only way to handle this case?

using split is the easiest way.
use something like this
&test = "[email protected];[email protected]";
&array = Split(&test, ";");
for &i = 1 to &array.Len
&email = &array[&i];
/* Do some processing */
end-for;
if you do not want to use split try using the following
&string = "[email protected];[email protected];[email protected];";
While Find(";", &string) != 0
&pos = Find(";", &string);
&email = Substring(&string, 1, &pos - 1);
&string = Substring(&string, &pos + 1, Len(&string) - &pos);
End-While;
Really, there are a lot of different possibilities of achieving what you want ...
Edited by: Hakan Biroglu on Jul 10, 2012 4:15 PM

Similar Messages

  • String function in Oracle 9i to find part of string having two positions

    Hi,
    We need to extract the part of string having start and end position.
    Like
    Suppose the string is "TYPE ref_cur_type IS REF CURSOR" and need to extract name of the ref cursor i.e ref_cur_type.The length of the output is not fixed. But not able to extract the exact string.
    Thanks,

    What is the criteria for part of string? Do you give start character and end character position like 3,9 etc? Or its just that the word that comes between two spaces?
    Cheers
    Sarma.

  • How to used REGEXP_REPLACE  for replace part of string ?

    hi
    How can i replace part of string as following , i want to replace space in date by "-"
    SELECT
    REGEXP_REPLACE(upper('Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012'),
    '[0-9]{1,2}[^0-9](JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC)[^0-9][0-9]{4}',
    ' ','-') "REGEXP_REPLACE"
    FROM DUAL;
    the output will be like this
    Daivd bought stuff by 2000 USD on 12-Sep-2012 from KL and left kl on 20-Sep-2012
    regards

    I thought the questions is answered.
    Your code will not work, because the alternate expression applies only to the four digit year and the month.
    If you want to recognize both date formats with one expressions, you have to group the complete expressions.
    The disadvantage of this would be, that the backreferences would not work in the same way because you would have more groups.
    I advice to use two separate regular expressions for this task.
    Take a look at the following example if you simply want to fill the gaps with -:
    with yourtable as
      select 'Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012' text from dual union all
      select 'Daivd bought stuff by 2000 USD on Sep, 20 2012 from KL and left kl on Sep, 20 2012' text from dual 
    SELECT
    REGEXP_REPLACE(
    REGEXP_REPLACE(text,
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})','\1-\2-\3',1,0,'i'),
    '(JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC), ([0-9]{1,2}) ([0-9]{4})','\1-\2-\3',1,0,'i') regexp_replace
    FROM yourtable;If you want same output-format for both date formats you could use this:
    with yourtable as
      select 'Daivd bought stuff by 2000 USD on 12 Sep 2012 from KL and left kl on 20 Sep 2012' text from dual union all
      select 'Daivd bought stuff by 2000 USD on Sep, 20 2012 from KL and left kl on Sep, 20 2012' text from dual 
    SELECT
    REGEXP_REPLACE(
    REGEXP_REPLACE(text,
    '([0-9]{1,2}) (JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC) ([0-9]{4})','\1-\2-\3',1,0,'i'),
    '(JAN|FEB|MAR|APR|JUN|JUL|AUG|SEP|OCT|NOV|DEC), ([0-9]{1,2}) ([0-9]{4})','\2-\1-\3',1,0,'i') regexp_replace
    FROM yourtable;Edited by: hm on 25.09.2012 22:00

  • Get last part of strings

    Hello,
    I have a table like bellow
    id group_name
    1 TW Product Analyst PE
    2 TW Tech Support Analyst SP
    3 TW Tech Support Manager CE
    4 TW Manager SP
    5 Another Group Without End With 2 Characters
    6 TW Product Coodinator MG
    I would like to get just the last part of strings that ends with 2 characters(these 2 characters are states in Brazil).
    The query answer need to seems like bellow
    id group_name
    1 PE
    2 SP
    3 CE
    4 SP
    6 MG
    I appreciate any kind of help.
    Thanks

    user5495111 wrote:
    Another way
    with d as (
    Select 1 id, 'TW Product Analyst PE' group_name from dual union all
    Select 2, 'TW Tech Support Analyst SP' from dual union all
    Select 3, 'TW Tech Support Manager CE' from dual union all
    Select 4, 'TW Manager SP' from dual union all
    Select 5, 'Another Group Without End With 2 Characters' from dual union all
    Select 6, 'TW Product Coodinator MG' from dual
    select id, substr(group_name, -2)
    from d where id not in(select id from d where trim(substr(group_name,-3,1)) is not null)
    This will not work if the fifth row id is null
    with d as (
    Select 1 id, 'TW Product Analyst PE' group_name from dual union all
    Select 2, 'TW Tech Support Analyst SP' from dual union all
    Select 3, 'TW Tech Support Manager CE' from dual union all
    Select 4, 'TW Manager SP' from dual union all
    Select null, 'Another Group Without End With 2 Characters' from dual union all
    Select 6, 'TW Product Coodinator MG' from dual
    select id, substr(group_name, -2)
    from d where id not in(select id from d where trim(substr(group_name,-3,1)) is not null)
    no rows selectedInstead or NOT IN use IN Clause
    with d as (
    Select 1 id, 'TW Product Analyst PE' group_name from dual union all
    Select 2, 'TW Tech Support Analyst SP' from dual union all
    Select 3, 'TW Tech Support Manager CE' from dual union all
    Select 4, 'TW Manager SP' from dual union all
    Select null, 'Another Group Without End With 2 Characters' from dual union all
    Select 6, 'TW Product Coodinator MG' from dual
    select id, substr(group_name, -2)
    from d  a where id in  (
         select id from d b where trim(substr(group_name,-3,1)) is null)
            ID SU
             1 PE
             2 SP
             3 CE
             4 SP
             6 MG
    5 rows selected.SS

  • How to separate part of string using separator in java

    Hi
    I want to separate a part of a string having separator (/)
    FirstName / MiddleName / LastName
    Please help me

    MayureshJoshi wrote:
    Hi
    I want to separate a part of a string having separator (/)
    FirstName / MiddleName / LastName
    Please help meString.split(...)

  • RS232 Output Module - Checksum on part of String

    I am running DASYLab 11 and am trying to write a setpoint to a Eurotherm temperature controller via the EI-BISYNCH protocol over RS-232. This requires that I send some control characters and the address of the unit I am commanding, then the some control characters and the new setpoint value, and then an XOR checksum of the second part of the string (control characters + new setpoint). I can't seem to figure out a way to do this, as the /cx format command gives the checksum of the entire string. I tried placing the first part of the string in channel one, the second part and the checksum formatter in channel two, and then selecting sequential output, but that didn't work. Does anyone have any other ideas?
    Thanks for your time!!!
    Solved!
    Go to Solution.

    You will need two different strings... what are your strings? 
    I do have a very happy customer using Eurotherm controllers... but he uses OPC, not RS232.
    the help says this:
    Checksum
    Control Characters
    Description
    Cross sum
    \cq
    Adds all bytes before the checksum character including the contained measurement values and sends the cross sum with the string.
    If the format definition contains a \c control character, DASYLab makes the cross sum from the beginning of the string to the position of the control character. If the format definition contains several \c characters, DASYLab makes the subsequent cross sums from one checksum character to the next.
    CRC test
    \cc
    Calculates all bytes of the string to be sent with the CRC16 method. DASYLab sends the binary sequence of the CRC test and the binary sequence of the CRC test including the CRC value as the result. The sent binary sequence are not numbers but polynomials.
    XOR sum
    \cx
    Connects all bytes before the checksum character including the contained measurement values with the exclusive-or operator and sends the binary sequence with the character string.
    XOR sum with control character suppression
    \cy
    Executes the same operation as the XOR sum and adds 32 to the result byte if the result byte is smaller than 32.
    - cj
    Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.

  • Match string and retrieve part of string from match

    Hi,
    I'm trying to parse a html-page to retrieve a certain value.
    The string should match some pattern. Then I want to retrieve a part of the string from the match. In my example case: XXX.
    String string2Match = "    <input type=\"text\" name=\"match\" value=\"XXX\"       ";
    String regex = ".*<input type=\"text\" name=\"match\" value=\"\\w*\".*";
    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(string2Match);
    if (matcher.matches()) {
       // in this case I want to retrieve a part of the string from the match. here: XXX.
    }Can this be done, without parsing the matcher.group()-findings again.
    Thanks
    Jonny

    user11365587 wrote:
    My question was meant for strings in general.Then go here:
    http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
    and look for groups.
    You will end up by something like:Matcher matcher = Pattern.compile("[a-z]{2}(\\d+)(.*)").matcher("ab1234xy56");
    assertEquals("ab1234xy56",matcher.group(0));
    assertEquals("1234",matcher.group(1));
    assertEquals("xy56",matcher.group(2));bye
    TPD

  • Pull out part of string

    I have program that gives me the following data:User[type=Call Manager User,id=usersname,authenticated=true]I need to pull out just the part that is "usersname"
    The length of this part is variable, the rest is not.
    I don't normally program and am not very java familiar at all all.
    Thanks in advance!!

    Assuming the data you have is a String, and as you have said, it will always be the same apart from the id part, you could use the split method followed by the substring method to isolate the part you need. Something like:
    String[] arr = yourString.split(",");
    String id = arr[1].substring(3);Basically, you split the string into an array, using the commas as the delimeter, which will put "id=usersname" in the 2nd element of the array. Then, use the substring method to get the part of the string after the first 3 characters, "id=". Hope that helps.

  • Extracting second  part of string

    hi
    i have a string like abcd~12341sdfs
    I have to extract the string after ~ symbol
    Please let me know how ot do it

    Your same question from last week Extracting a part of Strng.

  • Extracting a part of string

    I have a string like 'abcd1234'. I want to extract only the number part to another variable. I dont know the occurance of the number in the string
    Please help me

    Please read this thread:
    Re: Splitting numbers and alphabets

  • REPLACE part of string

    Hi.
    I have a string column in a DB where it's values contain the following midway through the string ([DOCUMENTGUID] is a uniqueidentifier that is different for each row):
    <a href="../downloadDoc.aspx?dg=[DOCUMENTGUID]" target="_blank">
    I would like to replace this part of the string with a different piece of text.
    I know that I should be using PATINDEX and REPLACE functions but I don't know how to utilise.
    How can I go about this please?
    Thanks in advance.

    Assuming the string you gave is consistent you can use this
    SELECT STUFF(YourColumn,PATINDEX('%<a href="../downloadDoc.aspx?dg=%',YourCol),PATINDEX('%target="_blank">%',YourCol)- PATINDEX('%<a href="../downloadDoc.aspx?dg=%',YourCol) +1 ,'<your new text')
    FROM table
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to fetch the first part of string from a whole lenghty string

    Hi,
    I have a data like - ex1:
      Auto Update : 10/04/2014 08:04  NEW data: xxxx OLD data: yyyy Ack - etr03 : 10/04/2014 08:13
     Auto Update : 10/04/2014 15:24  NEW data1 :xxx  OLD data1: yyyy Auto Update : 10/04/2014 09:36  NEW data1: xxx1 OLD data1: yyy1 Auto Update : 08/04/2014 12:28  NEW data1: xxx2 OLD data1: yyy2 Ack - jmi08 : 10/04/2014 09:53 Ack -
    WWI13 : 10/04/2014 15:32
    I want to compare only NEW data: xxxx OLD data: yyyy or  NEW data1 :xxx  OLD data1: yyyy Auto Update : 10/04/2014 09:36  NEW data1: xxx1 OLD data1: yyy1 Auto Update : 08/04/2014 12:28  NEW data1: xxx2 OLD data1: yyy2with the same ste
    of value from another database but since I used substring I am getting even Ack - etr03 : 10/04/2014 08:13 value whose length changes for above 2 examples.
    USed substring to get NEW data1 :xxx  OLD data1: yyyy Auto Update : 10/04/2014 09:36  NEW data1: xxx1 OLD data1: yyy1 Auto Update : 08/04/2014 12:28  NEW data1: xxx2 OLD data1: yyy2 
    or
    NEW data: xxxx OLD data: yyyy
    but the ack part cannot be removed due to variable lenghts for each data hence could not compare this column between 2 databases. Any help would be highly appreciated.
    Thanks,
    Preetha

    HI ,
    THE INPUT IS
     EX 1:Auto Update : 10/04/2014 15:24  NEW data1 :xxx  OLD data1: yyyy Auto Update : 10/04/2014 09:36  NEW data1: xxx1 OLD data1: yyy1 Auto Update : 08/04/2014 12:28  NEW data1: xxx2 OLD data1: yyy2 Ack - jmi08 : 10/04/2014 09:53
    Ack - WWI13 : 10/04/2014 15:32
    EX 2: Auto Update : 10/04/2014 08:04  NEW data: xxxx OLD data: yyyy Ack - etr03 : 10/04/2014 08:13
    AND THE EXPECTED RESULT IS :
    EX1:NEW data1 :xxx  OLD data1: yyyy Auto Update : 10/04/2014 09:36  NEW data1: xxx1 OLD data1: yyy1 Auto Update : 08/04/2014 12:28  NEW data1: xxx2 OLD data1: yyy2
    EX2 : NEW data: xxxx OLD data: yyyy
    SINCE THE FILED LENGTH CHANGES I WANT TO WRITE A GENRIC QUERY WHICH FETCHES THE ABOVE DATA.I DO NOT WANT TO CREATE ANY TABLE
    Hi Preetha7,
    This make no sense. We cannot guess you database structure. 
    Please post DDL (Create table script)
    and DML (your current query)
    and expected output.
    For more info, please have a look at this thread:
    POSTING TIPS - Code, Images, Hyperlinks, Details
    Thanks!
    sqldevelop.wordpress.com

  • Extract 2nd part of string

    I have a desc field and I want to extract everything to the right of the hyphen.  Since you can't use substr in CR how can I do it?  Thanks so much in advance!

    There are a few options:
    1. Use Split to split on hyphens and then use the second element in the resulting array
    2. Use inStr to find the location of the hyphen (inStr returns back the index of the desired character in the string being searched) and then use Mid to retrieve all text after that index
    a programmer learning programming from perl is like a chemisty student learning the definition of "exothermic" with dynamite

  • Extract part of string

    I have a string of max length 40 characters. The string may contain 20 characters also with remaining 20 characters as 'SPACE'. Now from this string i want to fetch last four characters only
    e.g. If my string contains "    ABCDEFGH  ", then from this i want to fetch only last 4 characters i.e. "EFGH" only.
    How do i do it???

    Hi,
    You can do this using the offset.
    E.g
    Var1 = 'abcdefgh'
    then
    Write: Var1+0(4).
    this will extract the four characters from begining.
    Regards,
    DS

  • Extracting part of string - advice

    Hi Using oracle 11.2.0.3 and looking at somebody else's code
    Folling sql
    SELECT cd_customer_num,cd_postcode,rtrim(substr(CD_POSTCODE, instr(CD_POSTCODE, ' ') + 1), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') postcode_inner
    from customer_details_stg2
    where length(cd_postcode) = 7This code works for nearly all postcodes - attempt is to get the first digit after the space or spaces (could be two spaces betwene dfirst and second part of postcode)
    e.g.
    IP4 1AE gives postcode inner of 1 but postcode DI2 4R1 gives postcode_inner of 4R1
    Not quite sure how above works understand instr, substr etc but bot sure how the ABC... etc gives the right results in most cases.
    An advice on how to get the first numeric digit after the space or spaces and ensure this is only length of 1.
    Many Thanks

    Hi,
    user5716448 wrote:
    ... This code works for nearly all postcodes - attempt is to get the first digit after the space or spaces (could be two spaces betwene dfirst and second part of postcode)
    e.g.
    IP4 1AE gives postcode inner of 1 but postcode DI2 4R1 gives postcode_inner of 4R1Are you saying that '1' is the correct result from 'IP4 1AE', but the result from 'D12 4R1' should be (just) '4'?
    Here's one way:
    SELECT  cd_customer_num
    ,     cd_postcode
    ,     REGEXP_REPLACE ( cd_postcode
                     , '.* \D*(\d).*'
                     , '\1'
                     )     AS postcode_inner
    FROM    customer_details_stg2
    WHERE     LENGTH (cd_postcode) = 7
    ;In the 2nd argument to REGEXP_REPLACE:
    .*       means 0 or more of any characters
    <space>       has no special meaing, it literally means <space>
    \D*       means 0 or more non-digits
    \d       means a digit
    .*       means 0 or more of any characters
    The 3rd argument, '\1', means the expression insiode the 1st set of parentheses.
    So the function will look for a space, followed by a digit, with perhaps some non-digits in between. When it finds that pattern, it will replace it (along with any extra text before or after it) with just the digit.
    Since you're using Oracle 11, you could also do this with REGEXP_SUBST. Sorry, I'm not near an Oracle 11 database now, so I can't test that approach. I'm not sure if it would be any simpler.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    Point out where the query above is wrong, and explain how you get the correct results from that data in those places.
    See the forum FAQ {message:id=9360002}

Maybe you are looking for

  • Can't download Flex Builder Beta 3

    When I attempt to download Flex Builder Beta 3, I'm redirected to http://trials.adobe.com/pub/esd/labs/flex2/FlexBuilder2_B3_05-08.exe in Firefox and http://www.adobe.com/cfusion/entitlement/index.cfm?event=custom&sku=RC00211&e=labs in IE. In both ca

  • Compaq Presario Desktop, IJ750 (Inkjet)

    Hi, I am having problems with my computer printer in which it is jamming.  I cannot buy another printer to replace it because I am told that they no longer make Compaq printers or inkjet printers anymore.  Is it worth keeping my computer because I am

  • Covert multiple FM files to pdf siumtaneously?

    Hello All, I have about 2000 files of FM6.0 on my hard disk which has to be conerted to pdf for different reasons. I found that there is a possibilty to convert these fm files to pdf online with "Create Adobe PDF online" by uploading each file one by

  • I keep getting password error and I've changed my password 3 times

    I keep getting password error when I try to get a new app or a book from iBooks?

  • Output String Handling in Java

    Hi, guys............... How can I format my output I have a long text formula which consist of alot of "()","{ }" "[ ]" and some other special char. I want to see in a readable format. This output formula is approximately you can say 1 or 2 pages but