string Split in 2 words

Hello

If I have the string "test1 test2-ttt test3 '... How to split the string into two strings, so the 1st string contains the 1st Word and the second the words after the first space?
for example, in my case str1 = str2 = ttt-test2 test3 and test1

I tried with
select substr('test1 test2-ttt test3', 1, instr('test1 test2-ttt test3', ' ', instr(''test1 test2-ttt test3', ' ')+1)-1)
from dual;
but this isn't the desired result...

Thanks in advance!

Try
substr ("test1 test2-ttt test3", 1, instr('test1 test2-ttt test3',' ')-1) select word1, substr ('test1 test2-ttt test3', instr ("test1 test2-ttt test3 ',' '") + 1) double word2.

Alexander gelin
http://nimishgarg.blogspot.com/

Tags: Database

Similar Questions

  • issue of String.Split("")

    Hi you

    I have a string that contains a name entry, and I care about them overturned in 2 parts and the record within a table, the first name and last name.

    How do with string.split?

    My current code is

    myNameArray = str_adminInput.split("");

    This code only works if the names are: Jack Lee, June Poh.

    This code does not work if the names are: Lee Tok Kong, Tan Beng Seng.

    How to solve this problem?

    -Zainuu

    I think you can do this:

    var firstname:String = str_adminInput.substring (0, str_adminInput.indexOf(""));

    var secondname:String = str_adminInput.substring (str_adminInput.indexOf(""), str_adminInput.length);

    myNameArray = new Array (firstname, secondname);

  • Splits the string after the complete word

    Hello world

    I have a dynamic text that is shown completely if it has less then 280 characters. When more characters then 280 I shows the first 280 and after that I just put 3 points «...» ». Now, my question was whether it is possible to display the 3 points after the last full word after these 280 characters.

    Example today: 'it's just an examp... "(the word cuts)
    Example of how it should be: "it is just an example." (watch the whole word pieces around the suite)

    Thanks in advance!

    If this one won't, try this one:
    http://www.cflib.org/UDF/abbreviate

    "Shortens a string to roughly the length indicated, no stripping
    tags, ensuring that the end is not cutting a word in half and adding a
    character of the selection at the end."

    Azadi Saryev
    SABAI - Dee.com
    http://www.SABAI-Dee.com/

  • Replace a string with a textBox Word key

    I think no doubt about it the wrong way. My goal is to create a textField in a position of a key word in a textField and update the position based on that keyword

    Example: The planet RESPONSE is the 3rd away from the Sun. (I want the ANSWER keyword to generate a text field in the posion even in the question).

    My problem is trying to find a coherent solution to a dynamic list of questions.

    My code so far:

    var str:String = "Hi"it is an example RESPONSE.";

    var theText:TextField = new TextField();

    Answer.Text = str;

    addChild (theText);

    theText.y = answer.y;

    //!!!! my place of disorder! //

    theText.x = (answer.x + theText.text.length) + str.indexOf ("ANSWER");

    Thanks for any help or suggestion.

    You are welcome.

    and you're right: the tf should be added to the screen before their references are crushed and the tf of entry must use and Event.CHANGE, Event.TEXT_INPUT or TextEvent.TEXT_INPUT:

    function keywordF(questionS:String,keywordS:String,x:int,y:int):void {}

    var nextX:int = x;

    var a: Array = questionS.split (keywordS);

    var tf:TextField = new TextField();

    addChild (tf);

    TF.x = nextX;

    TF.y = y;

    TF. Multiline = false;

    TF. Text = a [0];

    tf.autoSize = "left";

    nextX += tf.width + 5;

    TF = new TextField();

    addChild (tf);

    tf.addEventListener (Event.CHANGE, textchangeF);  Create your textchangeF to check user input.

    TF. Multiline = false;

    TF. Text = keywords;

    TF. Border = true;

    TF.type = "Input";

    tf.autoSize = "left";

    TF.x = nextX;

    TF.y = y;

    nextX += tf.width + 5;

    TF = new TextField();

    addChild (tf);

    TF.x = nextX;

    TF.y = y;

    TF. Multiline = false;

    TF. Text = a [2];

    tf.autoSize = "left";

    }

  • Convert the text string into array of words

    I'm trying to convert an input string of sentence written with spaces between words in an array of strings of 1 d with one word in each element of the array.

    That's what I have so far, but his does not work as I would like.   I have trouble getting in the array to zero at the beginning of each series.

    Thank you

    Why don't you just use the String Array to worksheet and specify a space as a separator?

  • ORA-01436: CONNECT loop in the user data when the delimited string splitting by the

    I'm trying to split a string into records. The values are three characters more '-' with a limit of 12 values. The values themselves are a combination of two data, the first being two characters, a.

    The following example translates: ORA-01436: CONNECT BY a loop in the user data

    WITH
        Data(Code, Datum)
    AS
        (
         SELECT 'VGCU3VM', '00V-YYG-BVC-PIU-DV3-EVV-TVM-' FROM Dual UNION ALL
         SELECT 'VGAU3VM', '00V-YYG-BVA-PIU-DV3-EVV-TVM-' FROM Dual UNION ALL
         SELECT 'VGLN3CM', '00V-YYG-BVL-PIN-DV3-EVC-TVM-' FROM Dual UNION ALL
         SELECT 'VGLT3PM', '00V-YYG-BVL-PIT-DV3-EVP-TVM-' FROM Dual UNION ALL
         SELECT 'VGAT3RA', '00V-YYG-BVA-PIT-DV3-EVR-TVA-' FROM Dual
        )
    SELECT
        Datum,
        LEVEL,
        SUBSTR(Datum, ((LEVEL - 1) * 4) + 1, 2),
        SUBSTR(Datum, ((LEVEL - 1) * 4) + 3, 1)
    FROM
        Data
    CONNECT BY
        Code    = PRIOR Code
        AND    LEVEL    <= LENGTH(Datum) / 4;
    
    

    Remove the 'Code = Code PREREQUISITE"clause, to avoid the error, but too many records are returned, because nothing is to limit the records in their own groups.

    The following works:

    WITH
        Data(Code, Datum)
    AS
        (
         SELECT 'VGCU3VM', '00V-YYG-BVC-PIU-DV3-EVV-TVM-' FROM Dual UNION ALL
         SELECT 'VGAU3VM', '00V-YYG-BVA-PIU-DV3-EVV-TVM-' FROM Dual UNION ALL
         SELECT 'VGLN3CM', '00V-YYG-BVL-PIN-DV3-EVC-TVM-' FROM Dual UNION ALL
         SELECT 'VGLT3PM', '00V-YYG-BVL-PIT-DV3-EVP-TVM-' FROM Dual UNION ALL
         SELECT 'VGAT3RA', '00V-YYG-BVA-PIT-DV3-EVR-TVA-' FROM Dual
        )
    SELECT
        Datum,
        SUBSTR(Datum, ((Some.Num - 1) * 4) + 1, 2) A,
        SUBSTR(Datum, ((Some.Num - 1) * 4) + 3, 1) B
    FROM
        Data,
        (SELECT LEVEL Num FROM Dual CONNECT BY LEVEL <= 12) Some
    WHERE
        SUBSTR(Datum, ((Some.Num - 1) * 4) + 1, 2) IS NOT NULL;
    
    

    What causes ORA-01436?

    Hello

    Depending on your version, you can add another condition to your CONNECT BY clause.

    It works in Oracle 11.2.0.3.0:

    SELECT

    Point of reference,

    LEVEL,

    SUBSTR (Datum, ((LEVEL-1) * 4) + 1, 2),

    SUBSTR (Datum, ((LEVEL-1) * 4) + 3, 1)

    Of

    Data

    CONNECT

    Code = Code PRIOR

    AND LEVEL<= length(datum)="">

    AND PRIOR SYS_GUID () IS NOT NULL-* ADDED *.

    ;

    Thanks for the display of the data of the sample; This is really useful!

    In addition, relational databases are designed to have 1 piece of information in each column of each row, not a list delimited by up to 12 points.  It is so basic to the design of database he called the first normal form.  You're going to solve a lot of problems even before they occur if you paste to first normal form and change the table structure to resemble the result set of this query.  (Maybe that's exactly why you're doing this query.)

  • Help with string.split() for line breaks and spaces

    What I'm trying to do is to take a series of numbers and convert it to a table, while cutting the numbers, aren't. Here's the format:

    1.0000000E + 000 + 000 1.3668423e

    1.0000000E + 000 + 000 1.3668423e

    1.0000000E + 000 + 000 1.3668423e

    ...

    So it is basically: space, space, digits, space, space, numbers, line break

    Right now I am using the following code (myString is a string, and dataSet1 is an array):

    var reg: RegExp = new RegExp ("\n");

    myString = textLoader.data;
    myString.split (reg) = dataSet1;

    I tried ("\n\s") and ("(\n)(\s*)") and many other combinations, but I can't seem to figure out how to make multiple conditions in a regular expression. All I need to do is to remove all the spaces and line breaks and I should be good.

    I appreciate any help, thanks.

    You can use the Array.map method to convert your strings. Something like this:

    function str2Num(element:*,_index:int,_arr:Array):Number
    {
    Return Number (item);
    }

    var arr:Array;

    ARR = myString.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s + /);

    ARR = map (str2Num, null);

    or combine them all in a single statement

    ARR = myString.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s + /) .map (str2Num, null);

  • string split or group

    I want to divide and put the string in table... for example I want to group 4 which is array1 and array2, array3, array4

    and then if I write 1111 0010 he enters my array array1 and 0010 will be my value below

    so if I write 2222 0011 he enters my array array2 and 0011 will be my value underneath and so forth for array3 and array4

    simplify I write 1111 0010 3333 2222 0011 0012 4444 0013 that my table will look like this

    table 1 table 2 array3 array4

    0010 0011 0012 0013

    If other than the 1111,2222,3333 and I want to ignore it and it's the value of 4444

    can someone give me some example about it


  • String Split and join

    Hi all.

    I have a form with a TextBox for the display name and I want the fist letter capitalized in the first and last name.

    I have a function for it and everything works fine, the problem comes when there is a hyphen "-" in the name. I work part of split, but I can't make it work on the side of the join.

    function ucFirstAllWords( str )
    {
              var pieces = str.split(" "); //use this for space and "-" split (/[ \/-]/);
        for ( var i = 0; i < pieces.length; i++ )
        {
            var j = pieces[i].charAt(0).toUpperCase();
            pieces[i] = j + pieces[i].substr(1);
        }
        return pieces.join(" ");
    }
    
    

    If I use this code and slpit on the hyphen and space all get the join with the space, I tyed to do a function in function to capture the first hyphen, but that did not work probably hurting

    Does anyone have an idea how to fix?

    I am on LK 8.0

    Thank you.

    Fredrik Nordstrand, Sweden

    Hi Scott.

    I want to 'john doe' to be "John Doe" and 'Rose of ann-lee' to be 'Ann - Lee Rose Bush.

    Make any sense?

    Woks fine scrip but not with a name that contains a hyphen.

    If I use the split to include the hyphen "ann-lee" would become "Ann Lee" and that's not true.

  • String.Split on temporal Bay of the URL button

    Hi people.

    It is therefore part of the current video player that I am. Here is the configuration of the problem:

    customer must have taken URL applied to an invisible button when commercials (usually 30 seconds each). There are some javascript controls that populate the click URL, which are separated by ",". The tracking URL could be between one and 3 URLS per 30 second commercial. If it is 3, then the URL changes every 10 seconds.

    Right now I have the button work - any. Javascript fills the invisible button, but when you click on the button during the commercial you get the pop-up windows three rather than one by trading block (i.e. y three popups different with three different URL - but at the same time, just by click).

    Code is below / attached.

    However, when I add in this code, it just seems looped and stops the action of the button. For most the 'if' statement is the problem.

    So no idea on how I can get the URL to fill one at a time by time frame?

    If you want to hire me to solve your problem, send me an email via my website.

  • Replace in the last instance of expression string research with new words

    I have the T table with the data in the example below. The data have occurrences of phrace "ab" several times, several places. I want to replace the LAST occurrence of "ab" with the value "ab_last". How to write this query?
    with T as
    (
    select 'some symbols
      ab cd
      lot of occurences of ab here
      this is last ab occurence: ab
      some more symbols ' s from dual
    )   
    select REGEXP_REPLACE(T.s, '([^ab.]+)','\1_last;') as s from T
    /*
    END some sym_last;bols
      ab cd
      lot of occurences of ab here
      this is last ab occurence: ab
      some more symbols 
    */
    I think that Oracle has no function "ReplaceLast". And regular expressions cannot specify filter "the last of ' as I understand it. Then how to write the query?

    Expected result:
    'some symbols
      ab cd
      lot of occurences of ab here
      this is last ab occurence: ab_last
      some more symbols '
    --
    I have the 10g version.
    regexp_replace(T.s,'ab','ab_last',instr(T.s,'ab',1,-1))
    
  • Words in the string?

    I have a string

    for example: ' Welcome to flash forums!

    I need a function that returns the number of words (sperated by spaces)

    The string is not user entered, so if I need to understand something between words to achieve this, it is possible...

    Thank you.

    Use the string split method

    var st:String = ' Welcome to flash forums! "

    Var words: Array = st.split("");

    trace (Words.Length);

  • Split string

    Dear Sir

    Is there a simple function like string.split

    I want to just split this string 384; 603; 107; 38

    Rgds

    Nadir

    and this thread can also help you:

    http://supportforums.BlackBerry.com/T5/Java-development/how-to-split-a-string-in-to-a-string-array-w...

  • want to use regexp_replace in pl/sql to replace a string containing repeat them consecutive to a words

    Hi Experts,

    I want to use regexp_replace in pl/sql to convert a string containing consecutive repeat words have only one.

    for example: "is my name and and I was waiting for waiting for what it" should be replaced by "is my name and I was waiting for it."

    Thanks in advance

    Gordon

    A slight change '(\w+\S\W)\1+' )

    Concerning

    Etbin

  • String is split for model [|]

    Hello I want to split the string with "[|]" so what is the model for string split for this

    Concerning
    Mayur Mitkari

    Mayur Mitkari wrote:
    his does not work

    Yes.

Maybe you are looking for

  • Pavilion 15: upgrading RAM

    I want to add a bar of 4 GB RAM, my laptop has 2 RAM slots. But I heard that if I add more RAM, the store will open the cover of laptop so my laptop will not be guaranteed by HP more. I want to know how to add more RAM, but keep the HP warranty

  • What is the size of the ODD in Acer Aspire ES1-521?

    Hi, I ordred my new Acer Aspire ES1 - 521 (A4-6210), to use as a backup PC. I want to add an SSD, and I don't want to throw the HARD drive. I have my planning to place the HARD disk in a HARD drive enclosure. But I don't know what size to buy. It is

  • eFax: not connected to the internet error

    I have a Photosmart 7510, running on Windows 8 (which shouldn't matter, since my question).  All internet connections are fine, except eFax custody claiming that I am not connected to the internet.  I have tried to change the DNS by hand, reset the c

  • I need help and I did everything but replace my computer and the operating system.

    I invaded by the windows updates, drivers, hardware (found and installed by administrators network supposed recntly) IE9, won ' t hold my settings and my user rights change daily.  I can even find another computer in the supposed network, which I hav

  • «"Discover your networks Active to connect or disconnect"»

    Windows 7 x 64 Home Premium. Just for my own interest, under the "network and sharing" Section, it says "View Your Active Networks" and there is a blue link next to him to "connect or disconnect." By clicking on the blue link just brings a list of ne