Regarding string functions

hi all,
i have a text file as following
linkstable
linkname,linkpage
linkpage
xxxxxxxxxxxxnow i have to read the file ,ie., i have to get Strings in between the "#" ie.,
i have to find the occurance of the "# " and then the string between them how can i do this
do we have any method to find the repeated occurance of a string in java
could any one help me
thanks in advance

A lot of this is going to depend on your definition of "between"
Text1
Text2
Text3
#Text4#
In the previous example Text3 is the only answer, Text4 is the only answer, or all of the Texts are the answer, which is it? If you don't know, go back to your teacher and find out--you cannot code for a problem that does not have a known outcome. You need much better problem definition before an algorithm can be developed to provide a solution to code.

Similar Messages

  • Contains (String function) is not working in switch condition .

    Hi All ,
    I have a interface in which there are two projects.
    1 notification interface
    2 DFW interface .
    Project 1 Has Mediator in it where I am checking a Filter condition on DESTINATION PARTNER ID as below
    contains($in.request/inp1:TSOHoldCommon/inp1:Destination_Partner_ID,'DFW')
    as you all know this is the string function(containd) I have used.
    But there is a problem I am facing , when i use the same condition in DFW INTERFACE in all the switch conditions i have used .
    So now the problem is in switch condition used in BPEL of DFW INTERFACE.
    I have a asign statement after this condition,and i am getting assign pending so flow is faulting.
    please help me in this regard or give me any suggestions for fixing this .
    BPEL VERSION 1.1
    SOA 11.1.1.6

    Please post the error log which you are getting in EM.
    Thanks,
    Ashutosh

  • [OT] User-Defined string Functions  Oracle PL/SQL

    Ladies and Gentlemen,
    I am pleased to offer the following string functions Oracle PL/SQL:
    GETALLWORDS(): Inserts the words from a string into the table.
    GETWORDCOUNT(): Counts the words in a string.
    GETWORDNUM(): Returns a specified word from a string.
    OCCURS(): Returns the number of times a character expression occurs within another character expression (including overlaps).
    OCCURS2(): Returns the number of times a character expression occurs within another character expression (excluding overlaps).
    PADC(): Returns a string from an expression, padded with spaces or characters to a specified length on the both sides.
    STRTRAN(): Searches a character expression for occurrences of a second character expression, and then replaces each occurrence with a third character expression. Unlike a built-in function Replace, STRTRAN has three additional parameters.
    STRFILTER(): Removes all characters from a string except those specified.
    RAT(): Returns the numeric position of the last (rightmost) occurrence of a character string within another character string (including overlaps). The search performed by RAT() is case-sensitive. RAT similar to the PL/SQL function INSTR.
    ATC(): Returns the beginning numeric position of the first occurrence of a character expression within another character expression, counting from the leftmost character (including overlaps). The search performed by ATC() is case-insensitive. ATC similar to the PL/SQL function INSTR.
    RATC(): Returns the numeric position of the last (rightmost) occurrence of a character string within another character string (including overlaps). The search performed by RATC() is case-insensitive. RATC similar to the PL/SQL function INSTR.
    AT2(): Returns the beginning numeric position of the first occurrence of a character expression within another character expression, counting from the leftmost character (excluding overlaps). The search performed by AT2() is case-sensitive. AT2 similar to the PL/SQL function INSTR.
    REPLICATE(): Returns a character string that contains a specified character expression repeated a specified number of times.
    ROMANTOARAB(): Returns the number equivalent of a specified character Roman numeral expression (from I to MMMCMXCIX).
    Plus, there are versions for MS SQL SERVER, SYBASE ASA, DB2, MS SQL SERVER 2005 SQLCLR.
    More than 8000 people have already downloaded my functions. I hope you will find them useful as well.
    For more information about string UDFs Oracle PL/SQL please visit the
    http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,54,33,29233
    Please, download the file
    http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,2,29233
    With the best regards.

    >
    I am using the Oracle Data Provider in vs2012. I am having trouble calling a function that returns an object type defined.
    >
    Returning a collection like that is a bad idea to begin with. That isn't scaleable and wastes memory.
    Either return a REF CURSOR and let the client FETCH the rows or use a PIPELINED function and let the client query it like they would a table.
    Here is an example similar to yours that uses a PIPELINED function.
    create or replace
        package pkg2
          as
            CURSOR emp_cur is (SELECT empno, ename, job, mgr, deptno FROM emp);
            type pkg_emp_table_type is table of emp_cur%rowtype;
            function get_emp(
                             p_deptno number
              return pkg_emp_table_type
              pipelined;
      end;
    create or replace
        package body pkg2
          as
            function get_emp(
                             p_deptno number
              return pkg_emp_table_type
              pipelined
              is
              begin
                  for v_emp_rec in (SELECT empno, ename, job, mgr, deptno
                                    FROM emp where deptno = p_deptno) loop
                    pipe row(v_emp_rec);
                  end loop;
              end;
      end;
    select * from table(pkg2.get_emp(20));
           EMPNO ENAME      JOB              MGR     DEPTNO
            7369 DALLAS     CLERK2          7902         20
            7566 DALLAS     MANAGER         7839         20
            7788 DALLAS     ANALYST         7566         20
            7876 DALLAS     CLERK           7788         20
            7902 DALLAS     ANALYST         7566         20

  • Regarding String Replacing ....

    Hi Friends,
    I have some problem regarding String replacing.
    ex.
    I have following string ::
    =================================================
    This is the java manager the main purpose for the jasper is used to create reports.
    And the Java language is very extensible.
    Is this the proper string functions provided by java isn't it ?
    *================================================*
    *i want to replace word "is"  with "IS". but that word is not connected to word like  Th{color:#ff00ff}is{color}*
    *differ from simple separate "{color:#ff0000}is{color}" so Word should not be replaced in This only separate "is"*
    *must be replaced. ?*
    *Any Idea ?*
    *{color}*
    Edited by: Ghanshyam on Sep 14, 2007 4:27 PM

    How about just searching for and replacing
    " is "
    instead of
    "is"
    So, using this code from the Java Developers Almanac 1.4 (2002 Addison-Wesley):-
    static String replace(String str, String pattern, String replace) {>    int s = 0;>    int e = 0;>    StringBuffer result = new StringBuffer();> >    while ((e = str.indexOf(pattern, s)) >= 0) {>       result.append(str.substring(s, e));>       result.append(replace);>       s = e+pattern.length();>  result.append(str.substring(s));
    return result.toString();
    }Your would use:-
    String newStr = replace(originalStr, " is "," IS ");
    Edited by: mad_scientist on Sep 14, 2007 4:16 AM (Sorry about all the edits, just getting used to the formatting on here)
    Edited by: mad_scientist on Sep 14, 2007 4:22 AM
    Edited by: mad_scientist on Sep 14, 2007 4:24 AM

  • Overloading string functions

    hi everyone
    i have a doubt regarding overloading concept in strings .i need to know whether we can overload string functions in java.you can take any function available in the string class.
    regards
    kvikram

    The whole class of String is final, so you won't be able to inherit from it - and therefore, not overload any methods.
    String is one of these very special constructs in Java, which are not meant to be enhanced or costumized.

  • Whats happening internally within the unflatten from string function?

    I am getting unflatten from string error intermitently in my program. I can't post the program to get help but essentially I am storing a GOOP object reference as a string. The reference is flattened to a string and stored upon creation, at a latter time the string is then unflatterned to retrieve the reference and then the data. This works most of the time but occansionaly the unflatterned from string function fails. Prior to passing the string to the function I am checking that the string isn't null. I am assuming something else is corrupting the string prior to passing to this fucntion and would like to know what would trigger the error in the function as it may help me realise what is happening
    prior.
    Cheers,
    Wayne

    Hi,
    It really seems strange this problem, but one thing that might be the cause is how you store the flatten string. You do not mention that. I have once had problems when storing GOOP references as a sting and passing them between test VIs in TestStand using a string parameters in TestStand. A flatten string might have special chars that not all applications (such as TestStand parameters) can handle that and just trunkate the string when such a char is present, mistakenly inteprets that as end of string. Have you tried to check that string length is the same?
    However to make sure you get rid of all problems with string termination, you really should cast your GOOP reference into something else. I would instead cast the reference to an U32, or
    if you want, to solve the string problem for other types than GOOP reference, then flatten the type into string and then convert the string to an array of U8 before storing it. This would by sure solve your problem.
    Regards,
    Mattias Ericsson
    Endevo
    Sweden
    Main developer of the new GOOP2 and GOOP Wizard 3.
    PS! Have you seen that there is a new GOOP release that also may handle inheritance? Please check out: http://www.endevo.se/default.asp?lang=eng and click on "Products". There are examples, demos and white papers describing the new GOOP Inheritance Toolkit.
    Attachments:
    CastRefExample.vi ‏18 KB

  • I've designed Calculator Program, used by String function

    Hello Everyone,
                                  I've designed Calculator Program, used by String function. U've any Feedback in this program, cantact me.  
    Thanks & Regards,
    SABARI SARAVANAN M
    Certified LabVIEW Associate Developer
    Attachments:
    calculator.vi ‏71 KB

    Hi Jitendra,
    Does the dump log shows that the cause is memory shortage?
    Thanks and Best Regards,
    Vikas Bittera.
    **Points for useful answers**

  • A query regarding synchronised functions, using shared object

    Hi all.
    I have this little query, regarding the functions that are synchronised, based on accessing the lock to the object, which is being used for synchronizing.
    Ok, I will clear myself with the following example :
    class First
    int a;
    static int b;
    public void func_one()
    synchronized((Integer) a)
    { // function logic
    } // End of func_one
    public void func_two()
    synchronized((Integer) b)
    { / function logic
    } // End of func_two
    public static void func_three()
    synchronized((Integer) a)
    { // function logic
    } // End of func_three, WHICH IS ACTUALLY NOT ALLOWED,
    // just written here for completeness.
    public static void func_four()
    synchronized((Integer) b)
    { / function logic
    } // End of func_four
    First obj1 = new First();
    First obj2 = new First();
    Note that the four functions are different on the following criteria :
    a) Whether the function is static or non-static.
    b) Whether the object on which synchronization is based is a static, or a non-static member of the class.
    Now, first my-thoughts; kindly correct me if I am wrong :
    a) In case 1, we have a non-static function, synchronized on a non-static object. Thus, effectively, there is no-synchronisation, since in case obj1 and obj2 happen to call the func_one at the same time, obj1 will obtain lock for obj1.a; and obj2 will obtain lock to obj2.a; and both can go inside the supposed-to-be-synchronized-function-but-actually-is-not merrily.
    Kindly correct me I am wrong anywhere in the above.
    b) In case 2, we have a non-static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a. However, since obj1.a and obj2.a are the same, thus we will indeed obtain sychronisation.
    Kindly correct me I am wrong anywhere in the above.
    c) In case 3, we have a static function , synchronized on a non-static object. However, Java does not allow functions of this type, so we may safely move forward.
    d) In case 4, we have a static function, synchronized on a static object.
    Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a. However, since obj1.a and obj2.a are the same, thus we will indeed obtain sychronisation. But we are only partly done for this case.
    First, Kindly correct me I am wrong anywhere in the above.
    Now, I have a query : what happens if the call is made in a classically static manner, i.e. using the statement "First.func_four;".
    Another query : so far we have been assuming that the only objects contending for the synchronized function are obj1, and obj2, in a single thread. Now, consider this, suppose we have the same reference obj1, in two threads, and the call "obj1.func_four;" happens to occur at the same time from each of these threads. Thus, we have obj1 rying to obtain lock for obj1.a; and again obj1 trying to obtain lock for obj1.a, which are the same locks. So, if obj1.a of the first thread obtains the lock, then it will enter the function no-doubt, but the call from the second thread will also succeed. Thus, effectively, our synchronisation is broken.
    Or am I being dumb ?
    Looking forward to replies..
    Ashutosh

    a) In case 1, we have a non-static function, synchronized on a non-static object. Thus, effectively, there is no-synchronisationThere is no synchronization between distinct First objects, but that's what you specified. Apart from the coding bug noted below, there would be synchronization between different threads using the same instance of First.
    b) In case 2, we have a non-static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a.obj1/2 don't call methods or try to obtain locks. The two different threads do that. And you mean First.b, not obj1.b and obj2.b, but see also below.
    d) In case 4, we have a static function, synchronized on a static object. Here, again if obj1, and obj2 happen to call the function at the same time, obj1 will try to obtain lock for obj1.a; while obj2 will try to obtain lock for obj2.a.Again, obj1/2 don't call methods or try to obtain locks. The two different threads do that. And again, you mean First.b. obj1.b and obj2.b are the same as First.b. Does that make it clearer?
    Now, I have a query : what happens if the call is made in a classically static manner, i.e. using the statement "First.func_four;".That's what happens in any case whether you write obj1.func_four(), obj2.func)four(), or First.func_four(). All these are identical when func_four(0 is static.
    Now, consider this, suppose we have the same reference obj1, in two threads, and the call "obj1.func_four;" happens to occur at the same time from each of these threads. Thus, we have obj1 rying to obtain lock for obj1.aNo we don't, we have a thread trying to obtain the lock on First.b.
    and again obj1 trying to obtain lock for obj1.aYou mean obj2 and First.b, but obj2 doesn't obtain the lock, the thread does.
    which are the same locks. So, if obj1.a of the first thread obtains the lock, then it will enter the function no-doubt, but the call from the second thread will also succeed.Of course it won't. Your reasoning here makes zero sense..Once First.b is locked it is locked. End of story.
    Thus, effectively, our synchronisation is broken.No it isn't. The second thread will wait on the same First.b object that the first thread has locked.
    However in any case you have a much bigger problem here. You're autoboxing your local 'int' variable to a possibly brand-new Integer object every call, so there may be no synchronization at all.
    You need:
    Object a = new Object();
    static Object b = new Object();

  • Search and replace string function

    Hello, I am using the "search and replace string" function and it does nt seem to work consistently for me.   I am using it in a situation where I am taking an array of strings, converting this into a spreadsheet string then deleting all of the commas.  Has anyone experienced the same behavior? I have searched through other posts and found other simular faults but none of the fixes worked for this. I can post the code it needed.
    Thanks,
    Andrew

    I agree that commas are often not desirable, especially if your software should also work in countries where comma is used as a decimal seperator.
    Where are the commas coming from? Does (1) each element of the original array have one (or more), do you (2) use comma as seperator if you convert it to a spreadhseet string?
    For (1), you might just strip out the comma for each element right in the loop. For case (2) you would simply use a different separator to begin with, of course.
    Btw: you are abusing a WHILE loop as a FOR loop, because you have a fixed number of iterations. Please replace it with a FOR loop. If you use a FOR loop, LabVIEW can manage memory much more efficiently, because it can allocate the entire output array before the loop starts. For While loops, the total number of iterations is not known to the compiler. (Of course a real program would also stop the loop if an error occurs. In this case you would need to stay woth the WHILE loop. )
    Do you have a simple example how the raw array elements look like. How many commas are there?
    LabVIEW Champion . Do more with less code and in less time .

  • Error in XSLT mapping while using string functions

    Hi All,
    While using tokenize() and substring-before() functions in XSLT mapping,we are getting an error.The error message is Unexpected symbol "" So while using string functions in XSLT mapping do we have to use any header functions.
    Please through light on syntax etc.,of string functions in XSLT.
    Thanx in advance,
    Lokesh Dhulipudi
    Edited by: LOKESH DHULIPUDI on Dec 27, 2007 7:32 AM

    Hi,
    Hope you have gone thru this help:
    http://w3schools.com/xsl/default.asp
    Rgds, Moorthy

  • Wrong use of "Scan From String" function in a while loop?

    Hi,
    I've got a "Scan From String" function inside a while loop. On the first iteration it converts correctly the number passed by the input string (for example 4) But on the second one it has only spaces (one or more \s) as input string.
    I expected to obtain a zero as output (as it does always that it can not make any conversions, as I am supposed to) but indeed, i subtracts 1 from the previous number (according to the number indicated as example I would obtain a 3 as output)
    What's wrong with this?
    Does the function fails on this case?
    The rest of the diagram o the VI is expected to manage a 0 on that situation, like others in which the conversion is not made.
    Andres.

    I have simplified the VI evading calls to other VIs and trying to reproduce the mistake.
    The type of string I introduce to reproduce the mistake is:
    clock 3 (30) clock (40)
    Forgetting to introduce a number between the second "clock" and the following parenthesis, I would manage it programmatically with code that isn't included.
    Then "Scan From String" is supposed to do not make a conversion. But it leaves a 2 as output (in this example)
    I have realised, unbelievable but true, that it has matter with the number I substract to the output number (if it were 2, I would obtain 1 as output and so on)
    Excluding that, I got the conversion made before as output, 3, on the second time that "Scan From String" executes. But, how can this func
    tion as bad?
    I am using LV4 on an old PC. I have tried to reproduce it with LV6 and it works. But it isn't desirable for me, I would have to convert a lot of VIs and surely I will find a lot of errors due to the conversion (I have already tried)
    Attachments:
    EXTCLOCK.VI ‏26 KB

  • Essbase MDX - string functions are not working!

    Hi all!
    this MDX code works fine (LEN function):
    With
    member Scenario.MS1 as 'Len([Account].currentmember.member_name)'
    select { Scenario.MS1} on columns from http://Planing.Budget
    this code raises error (UPPER or any string function):
    With
    member Scenario.MS1 as 'Upper([Account].currentmember.member_name)'
    select { Scenario.MS1} on columns from http://Planing.Budget
    The administration tool I am using is for version 11.1.1.3 ..
    why? O_o
    Edited by: serzzzh on 14.10.2009 22:54

    Unless maybe if you're using J2ME and have very tight memory requirements (are you?) either an array or a Vector should be fine to hold 8000 strings.
    So I'm guessing, either:
    1) you're using J2ME, have a device with tight memory, in which case you probably need a redesign, either to move data off the device and into an online service or the like, or possibly to use the record db system that's in one of the J2ME profiles (although 8000 seems like a lot of stuff to put in such a small form factor device).
    2) the strings are in fact enormous, in which case array-or-vector isn't the issue
    3) there's some other problem. maybe you have a runaway recursive method or something.

  • Split string function in oracle ...

    Hello,
    Little question, is there any split string function available in Oracle.
    SQL> select more_info
    2 from dba_advisor_findings;
    MORE_INFO
    Allocated Space:4390912: Used Space:4237403: Reclaimable Space :153509:
    select more_info as Allocated_Space,
    more_info as Used_Space,
    more_info as Reclaimable_Space
    from dba_advisor_findings
    Allocated_Space Used_Space Reclaimable_Space
    4390912 4237403 153509
    Thanks,
    Manish Gupta

    I explored more on SUBSTR and INSTR string functions ... and below is the solution
    select substr(more_info,instr(more_info,':',1,1)+1,instr(more_info,':',1,2)-instr(more_info,':',1,1)-1) as "Allocated_Space",
    substr(more_info,instr(more_info,':',1,3)+1,instr(more_info,':',1,4)-instr(more_info,':',1,3)-1) as "Used_Space",
    substr(more_info,instr(more_info,':',1,5)+1,instr(more_info,':',1,6)-instr(more_info,':',1,5)-1) as "Reclaimable_Space"
    from dba_advisor_findings;
    Allocated_Space
    Used_Space
    Reclaimable_Space
    4390912
    4237403
    153509
    Thanks...

  • Supplementary characters and string functions

    I am using AL32UTF8 as my database character set and plan to store Japanese supplementary characters in the DB character set itself. Do I need to use any special string functions for these supplementary Japanese characters.

    With the AL32UTF8 character set, supplementary characters like any other characters, except that they are the widest (4 bytes). You just need standard multibyte processing.
    With AL16UTF16 (NCHAR), and depending on your needs, you may want to use certain SQL function variants that have 4 in their name: LENGTH4, INSTR4, SUBSTR4, LIKE4.
    When retrieving AL32UTF8 supplementary characters through JDBC or OCI in UTF-16 mode, you have to take care of the fact that one AL32UTF8 supplementary character becomes 2 UTF-16 code units (a surrogate pair). This is important for buffer allocations, length calculations, and any code that can split strings into substrings.
    -- Sergiusz

  • How to build a library of string functions?

    I want to create a set of my own special string functions. Trouble is I cannot create a class that extends String because it has been declared final. I want to be able to use the existing String functions as well as my own. Any ideas?
    Thanks in advance.

    Create a class that doesn't extend String. Use the String methods. You don't have to extend a class to use its methods. Example:public class LameUtility {
      public static char getFirstCharacter(String s) {
        return s.charAt(0);
    }

Maybe you are looking for