Get part of string

I have the following string:
jdbc:odbc:dbName
I wish to get "dbName" from the string?

I have the following string:
jdbc:odbc:dbName
I wish to get "dbName" from the string?Parse it. :)
If the string always is constructed as follows:
<string>:<string>:<string>
Then you can just split it with regular expressions or with the stringtokenizer:
  String dbName = "jdbc:odbc:dbName".split(":")[2];

Similar Messages

  • 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

  • When I forward an e-mail, I get a long string of gobblygook that goes with it and I cannot figure out how to eliminate it without having to delete it every time

    When I forward an e-mail, I get a long string of gobblygook that goes with it and I cannot figure out how to eliminate it without having to delete it every time I forward an e-mail. The following is only part of the string that I am talking about. How can I eliminate this from the e-mail?
    Here is part of an excerpt from one of the strings:
    From: - Mon Aug 19 18:12:47 2013
    X-Account-Key: account1
    X-UIDL: 065B31352CC6B3C0789DEA7954395B55
    X-Mozilla-Status: 0001
    X-Mozilla-Status2: 00000000
    X-Mozilla-Keys:
    Return-Path: <[email protected]>
    Received: from hrndva-mxlb.mail.rr.com ([10.128.255.126]) by hrndva-imta07.mail.rr.com with ESMTP id <20130819211326470.DBUO12525@hrndva-X-Roving-StreamId: 0

    Sorry, Firefox doesn't do email, it's strictly a web browser.
    If you are using Firefox to access your mail, you are using "web-mail". You need to seek support from your service provider or a forum for that service.
    If your problem is with Mozilla Thunderbird, see this forum for support.
    [https://support.mozillamessaging.com/en-US/home] <br />
    or this one <br />
    [http://forums.mozillazine.org/viewforum.php?f=39]

  • How to get an XML string from a Java Bean without wrting to a file first ?

    I know we can save a Java Bean to an XML file with XMLEncoder and then read it back with XMLDecoder.
    But how can I get an XML string of a Java Bean without writing to a file first ?
    For instance :
    My_Class A_Class = new My_Class("a",1,2,"Z", ...);
    String XML_String_Of_The_Class = an XML representation of A_Class ?
    Of course I can save it to a file with XMLEncoder, and read it in using XMLDecoder, then delete the file, I wonder if it is possible to skip all that and get the XML string directly ?
    Frank

    I think so too, but I am trying to send the object to a servlet as shown below, since I don't know how to send an object to a servlet, I can only turn it into a string and reconstruct it back to an object on the server side after receiving it :
    import java.io.*;
    import java.net.*;
    import java.util.*;
    class Servlet_Message        // Send a message to an HTTP servlet. The protocol is a GET or POST request with a URLEncoded string holding the arguments sent as name=value pairs.
      public static int GET=0;
      public static int POST=1;
      private URL servlet;
      // the URL of the servlet to send messages to
      public Servlet_Message(URL servlet) { this.servlet=servlet; }
      public String sendMessage(Properties args) throws IOException { return sendMessage(args,POST); }
      // Send the request. Return the input stream with the response if the request succeeds.
      // @param args the arguments to send to the servlet
      // @param method GET or POST
      // @exception IOException if error sending request
      // @return the response from the servlet to this message
      public String sendMessage(Properties args,int method) throws IOException
        String Input_Line;
        StringBuffer Result_Buf=new StringBuffer();
        // Set this up any way you want -- POST can be used for all calls, but request headers
        // cannot be set in JDK 1.0.2 so the query string still must be used to pass arguments.
        if (method==GET)
          URL url=new URL(servlet.toExternalForm()+"?"+toEncodedString(args));
          BufferedReader in=new BufferedReader(new InputStreamReader(url.openStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
        else     
          URLConnection conn=servlet.openConnection();
          conn.setDoInput(true);
          conn.setDoOutput(true);           
          conn.setUseCaches(false);
          // Work around a Netscape bug
          conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
          // POST the request data (html form encoded)
          DataOutputStream out=new DataOutputStream(conn.getOutputStream());
          if (args!=null && args.size()>0)
            out.writeBytes(toEncodedString(args));
    //        System.out.println("ServletMessage args: "+args);
    //        System.out.println("ServletMessage toEncString args: "+toEncodedString(args));     
          BufferedReader in=new BufferedReader(new InputStreamReader(conn.getInputStream()));
          while ((Input_Line=in.readLine()) != null) Result_Buf.append(Input_Line+"\n");
          out.flush();
          out.close(); // ESSENTIAL for this to work!          
        return Result_Buf.toString();               // Read the POST response data   
      // Encode the arguments in the property set as a URL-encoded string. Multiple name=value pairs are separated by ampersands.
      // @return the URLEncoded string with name=value pairs
      public String toEncodedString(Properties args)
        StringBuffer sb=new StringBuffer();
        if (args!=null)
          String sep="";
          Enumeration names=args.propertyNames();
          while (names.hasMoreElements())
            String name=(String)names.nextElement();
            try { sb.append(sep+URLEncoder.encode(name,"UTF-8")+"="+URLEncoder.encode(args.getProperty(name),"UTF-8")); }
    //        try { sb.append(sep+URLEncoder.encode(name,"UTF-16")+"="+URLEncoder.encode(args.getProperty(name),"UTF-16")); }
            catch (UnsupportedEncodingException e) { System.out.println(e); }
            sep="&";
        return sb.toString();
    }As shown above the servlet need to encode a string.
    Now my question becomes :
    <1> Is it possible to send an object to a servlet, if so how ? And at the receiving end how to get it back to an object ?
    <2> If it can't be done, how can I be sure to encode the string in the right format to send it over to the servlet ?
    Frank

  • Server 2012 errors for timeout -- LDAP error number: 55 -- LDAP error string: Timeout Failed to get server error string from LDAP connection

    Hello, currently getting below error msg's utilizing software thru which LDAP is queried for discovering AD objects/path and resource enumeration and tracking.
    Have ensured firewalls and port (389 ) relational to LDAP are not closed, thus causing hanging.
    I see there was a write up on Svr 2003 ( https://support.microsoft.com/en-us/kb/315071 ) not sure if this is applicable, of if the "Ntdsutil.exe" arcitecture has changed much from Svr 03. Please advise. 
    -----------error msg  ----------------
    -- LDAP error number: 55
    -- LDAP error string: Timeout Failed to get server error string from LDAP connection

    The link you shared is still applicable. You can adjust your LDAP policy depending on your software requirements.
    I would also recommend that you in touch with your software vendor to get more details about the software requirements.
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • Cannot get questionnaire HTML string SAP CRM 7.0  EHP3

    Hello,
    We are trying to use questionnaires in Activities and it doesn't work.
    This error : Cannot get questionnaire HTML string is shown.
    I checked  Note 1600561 - Changes done in values template XSLT not taken into account, but it isn't valid for our release ( EHP3 )
    Thanks in advance for your help.
    Belén

    Hi,
    We used the questionnaires (questionnaires was displayed and worked) but we faced issues with the display in web UI (only when the questionnaires are linked to an activity/opportunity). The Admin screen for questionnaire works well).
    We have implemented the following notes in order to correct this displaying issues :
    - 1858059 : Upload the CRM_SVY_GENERATE_BSP_TEMPLATE.ZIP, refresh cash and generate all surveys
    And then notes mentioned above
    - 1914885 & 1944288 in the relevant order.
    But we cannot display anymore the existing surveys (They are active, all scenarios are flagged).
    Error message : Cannot get questionnaire HTML string
    Any Ideas how to proceed to solve ? (we work on EHP2)

  • DocNote 376987.1 getContentAsString vs get-content-as-string: is this fix ?

    I've hit a problem with orcl:get-content-as-string() (BPEL 10.1.2), which looks like it's already been identified. When multiple namespace are passed within a tag I get 'import not allowed on nodes of type element declaration'
    metalink search finds a technote (relevent text quoted below) but I can't find an actual bug report. Is the suggested use of ora:getContentAsString instead of orcl:get-content-as-string the only permanent solution? Are there any issues to be aware of when swicthing to ora:getContentAsString ?
    Regards
    Rob
    From Doc Note 376987.1:
    "The function "get-content-as-string()" might also throw the following error when the xml tags contains namespace declarations.
    "import not allowed on nodes of type element declaration"
    To workaround the error us the function "ora:getContentAsString()" instead
    The function "ora:getContentAsString()" has therefore always to be used in favor of the function "orcl:get-content-as-string()"

    use always: ora:getContentAsString()
    Reakted bug to this issue are bug 5103822 en 4283492

  • 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

  • How to get an XML string store in CLOB or LONG column ?

    How to get an XML string store in CLOB or LONG column ?
    We use XSU with the following command
    String str = qry.getXMLString();
    but all the "<" are replace by "&lt;"
    It's impossible to parse the result for XSLT transformation
    Thank's for your help
    Denis Calvayrac
    Example :
    in the column "TT_NAME"
    "<name><firstname>aaa</<firstname><lastname>bbb</lastname></name>
    I want this result
    <TT_NAME>
    <name>
    <firstname>aaa</firstname>
    <lastname>bbb</lastname>
    </name>
    </TT_NAME>
    but, I have this result
    <TT_NAME>
    &lt;name&gt;
    &lt;firstname&gt;aaa&lt;/firstname&gt;
    &lt;lastname&gt;bbb&lt;/lastname&gt;
    &lt;/name&gt;
    </TT_NAME>

    Can you post some of your code, so I can take a look ?
    Thanks

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

  • Memory leak in "get property value (string)" ?

    Hi,
    I'm not sure which forum to post this to because it involves a combination of labview and teststand.  The error I'm getting is more teststand related so it is here.
    In our application, we have a labview queued state machine launched by a teststand step using "launch vi asynchronously".  In one of the states of this state machine, we are looping grabbing frames from a camera, querying a teststand using "get property value (string)", to overylay on the video on each frame.  This is so when we post process the video, we can tell what step(s) teststand was performing (we are writing a status string to a property from teststand as well).  Since this string has to be overlayed on the video for each frame to be visible when played back, this happens many many thousands of times over the multi hour test runs of the platform.  
    My problem is, after 22 hours or so of running, I get an error generated from the "get property value (string)", saying cannot create any more threads.  The only thing wired to this tool in our vi is sequence context, which is passed in when the vi is launched from teststand.  When opening the "get property value (string)" vi itself, it is very simple, consisting of a "aspropertyvalue" casting, reading of the string from the proprety, closing the aspropertyvalue reference, and exiting.  It does not seem like there should be any "threads" being created here, except for perhaps the vi itself executing. But in that case I would assume the OS itself would clean up after itself. 
    BTW, the OS I am testing on is win7 x64.  I did see this though running on our xp box once as well though, same amount of time.  It is very repeatable.  My next plan is to disable this get property value using a disable case, and run again, but I"m still wondering why this error is occurring.  Any help or insight will be appreciated.
    Thanks
    David Jenkinson
    Hi,I'm not sure which forum to post this to because it involves a combination of labview and teststand.  The error I'm getting is more teststand related so it is here.
    In our application, we have a labview queued state machine launched by a teststand step using "launch vi asynchronously".  In one of the states of this state machine, we are looping grabbing frames from a camera, querying a teststand using "get property value (string)", to overylay on the video on each frame.  This is so when we post process the video, we can tell what step(s) teststand was performing (we are writing a status string to a property from teststand as well).  Since this string has to be overlayed on the video for each frame to be visible when played back, this happens many many thousands of times over the multi hour test runs of the platform.  My problem is, after 22 hours or so of running, I get an error generated from the "get property value (string)", saying cannot create any more threads.  The only thing wired to this tool in our vi is sequence context, which is passed in when the vi is launched from teststand.  When opening the "get property value (string)" vi itself, it is very simple, consisting of a "aspropertyvalue" casting, reading of the string from the proprety, closing the aspropertyvalue reference, and exiting.  It does not seem like there should be any "threads" being created here, except for perhaps the vi itself executing.  There seems to be something going on behind the scenes of this get property value tool that isn't cleaning up after itself?
    BTW, the OS I am testing on is win7 x64.  I did see this though running on our xp box once as well though, same amount of time.  It is very repeatable.  My next plan is to disable this get property value using a disable case, and run again, but I"m still wondering why this error is occurring.  Any help or insight will be appreciated.
    Thanks
    David Jenkinson

    Hi David,
    Have you tried just using property node | Method Nodes instead of using the VI. There should be no difference but I think that VI is polymorphic ie the input with change depending on what's wired to it eg string, double etc.
    Regards
    Ray Farmer

  • How can i get getwayed url string using pluggable nav in news portlet?

    hi.
    How can i get getwayed url string using pluggable nav in news portlet?
    A code just like below is what I want.
    <param value="param=http://.../portal/server.pt/gateway/PTARGS_.../http/...">
    I tryed the following, but didn't work as I wanted.
    1.<param value="<pcs:valueexpr='var'/>">
    -> transformed. but I want the prefix 'param=' in the enquoted string's too.
    2. <param value="param=<pcs:valueexpr='var'/>">
    -> not transformed.
    Any idea?
    Hiroyuki

    Hi all,
    We have HPROF functionality in our latest roadmap, so you will see that feature in our next major release called JRockit R28.
    I recommend, above from the MemLeak documentation suggested by Makiey, the following information on how to use JRockit tools.
    Performance Tuning & Profiling:
    http://download.oracle.com/docs/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/part_02.html
    Using JRockit tools:
    http://download.oracle.com/docs/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/part_03.html
    Diagnostics & Troubleshooting
    http://download.oracle.com/docs/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/part_04.html
    Best Regards,
    Tuva
    JRockit PM

  • I am having trouble printing  and am only getting part of the document which i have no margins set any help??

    i am having trouble printing  and am only getting part of the document  i have no margins set any help??

    What version of Pages?
    What Printer?
    If it is Pages '09, turn Comments off.
    Peter

  • I have tried to download an audiobook that has Two parts.  The second part of the book downloaded.  But the First point did not.  I keep getting "Part 1 could not download at this time".  How can I get it to download?

    I have tried to download an audiobook that contains Two Parts.  The second part was successful in downloading.  However, the first part was not.  I keep getting "Part 1 could not download at this time".  I should have enough space for the download.  Any suggestions of what I can do?

    Answered in the other thread you posted in:
    i am trying to download new software and my mac keeps asking for the administrator name and password... i enter my apple…
    Please don't post in more than one place. It can lead to people wasting their time answering a question which has already been answered elsewhere.

  • Getting non numeric strings using regular expression

    Hi Guys ,
    I  want to get list of string values in table which contains no numeric values  .....
    I have a   string column name A and table name B  .
    I have written following code , but it seems it is incorrect  .
    Plz help me out  .....
    SELECT
    A FROM
    B
    WHERE
    regexp_like(A, '([^[:digit:]])'
    Thanks in advance ....

    96097f0e-f165-463a-a0a2-3d15214c8a3d wrote:
    Hi Guys ,
    I  want to get list of string values in table which contains no numeric values  .....
    I have a   string column name A and table name B  .
    I have written following code , but it seems it is incorrect  .
    Plz help me out  .....
    SELECT
    A FROM
    B
    WHERE
    regexp_like(A, '([^[:digit:]])'
    Thanks in advance ....
    That will give you every one that has at least one non-numeric character, if you want ones which contain no numeric characters then it should be
    regexp_like(A,'^[^0-9]*$')

Maybe you are looking for