Looping through a string to search for a number?

I've been trying to use substr to loop through some text in a textfield I have cast as number.  Although there is a problem with this, substr only goes through strings so if I type something as a number, it wont loop through t.  Is there a similar function to loop through numbers?

use the string methods to find what you're looking for.  you can cast as a number when you've finished using the string methods.
or, you can use the regular expression class.

Similar Messages

  • Best way to loop through multiple rows to search for a count result

    I have a script where I'm trying to find a Rollup row without any children. I have created a SQL statement to do this, but I can only input one point at a time. If the count is greater than 0 then i'm good to go. If the count is 0 then I want to know about it.
    select count (*) from (Select * From ESSBASE_FCS.Ham
    where hier_pt like (Select substr(hier_pt, 1,8)||'%' as hcy_pt
    From ESSBASE_FCS.Ham
    Where Hier_Pt = '412375....')
    And Cctr_Or_Rollup 'Rollup')
    What is the best way to develop a SQL script that searches through all my Hier_pt's and return everything with a count of 0, instead of manually inputing each hier_pt at a time?
    Thanks for any help.

    Hi,
    Please read SQL and PL/SQL FAQ
    Please provide table structure, sample data and expected output.
    Additionally when you put some code please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    I noticed also that you have posted the same question here: {message:id=10678000}
    If you move your question to another forum please mark the previous question as answered.
    Regards.
    Al
    Edited by: Alberto Faenza on Nov 7, 2012 5:03 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Searching for the number in the bigint value...

    HI!
    Could anybody help me with the searching for the number in the bigint value. ex:
    9567423742840 i need to get only the 2nd and 3rd number (56) from this value...
     ^^
    and the same thing with symbols in the strings..
    is there any special function in jsp available for that?
    thanks

    try looking into the String class. There should be a substring or similar function that lets u get only a part of another string. You can convert the int into a string by doing something like new Integer(yourIntValue).toString() and then using that string for your substring function. There may be other ways to do it too, but this is the one I remember off the top of my head.
    Hope it helps
    package com.DJ_Java;

  • Loop through a csv file and return the number of rows in it?

    What would be simplest way to loop through a csv file and
    return the number of rows in it?
    <cffile action="read" file="#filename#" output="#csvstr#"
    >
    <LOOP THROUGH AND COUNT ROWS>

    ListLen(). Use chr(13) as your delimiter

  • Loop through Query String in ASP

    Hi,
    I am new to ASP and am trying to loop through values in a
    query string
    separated by a comma, for example:
    /site/search/results.asp?ids=19736a,20248a,14952a,19956a
    I need to construct SQL from this something like
    SELECT * FROM MyTable WHERE
    ID = 19736a OR
    ID = 20248a OR
    ID = 14952a OR
    ID = 19956a
    I am just unsure on how to separate all the values from the
    query string.
    Thanks for your advice.

    Oh, in the example below there is no space between the id
    numbers in the
    querystring.
    eg. ids=1,23,456,2
    If you do have spaces then you need to adjust the split
    accordingly
    eg. ids=1, 23, 456, 2
    you would use myIdArray=split(idStr,", ")
    note the space after the comma.
    just make sure you always use the same format in your
    querystring
    Justin
    "Justin Reid" <[email protected]>
    wrote in message
    news:e6osem$dfj$[email protected]..
    > You need to create an array of ids and then add them to
    your SQL.
    > Something like:
    > <%
    > If Request.QueryString("ids") <> "" Then
    > Dim idStr, cnt, varID
    > 'get the string of id'
    > idStr = Request.QueryString("ids")
    > 'create the array
    > myIdArray=split(idStr,",")
    > cnt=0
    > 'loop though the array and add to a new string
    > for i=o to ubound(myIdArray)
    > If cnt > 0 Then varID = (varID & " OR")
    > varID = (varID & " id = " & cStr(myIdArray(i)))
    > cnt=cnt+1
    > next
    > End If
    > %>
    >
    > Then simply add you new SQL segment to your recordset.
    > Something like
    >
    > SELECT * FROM MyTable WHERE" + Replace(varID, "'", "''")
    + "
    >
    > Hope that helps
    >
    > Justin
    >
    > "Shaun" <[email protected]> wrote in
    message
    > news:e6ole1$56v$[email protected]..
    >> Hi,
    >>
    >> I am new to ASP and am trying to loop through values
    in a query string
    >> separated by a comma, for example:
    >>
    >>
    /site/search/results.asp?ids=19736a,20248a,14952a,19956a
    >>
    >> I need to construct SQL from this something like
    >>
    >> SELECT * FROM MyTable WHERE
    >> (
    >> ID = 19736a OR
    >> ID = 20248a OR
    >> ID = 14952a OR
    >> ID = 19956a
    >> )
    >>
    >> I am just unsure on how to separate all the values
    from the query string.
    >>
    >> Thanks for your advice.
    >>
    >
    >

  • How to search for a number located anywhere in string

    I am trying to search a string for a number (integer or float) without knowing its index in the string and to extract it - whether in numeric or string format.  e.g. "the number 52.63 appears in this string"; I want to extract/identify "52.63"
    The functions I come across seem to expect the index to be known or the number to be at index 0.  How can I achieve this?
    Best regards.
    Kenoss
    Solved!
    Go to Solution.

    If you are about to dive into the 'wonderfull world of Regular Expression' don't miss this (regular-expressions.info) site.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Searching for a number that is not black

    I need to search a long document for a number at the start of a paragraph that is not black in color. Is there a way to do this in InDesign?
    With GREP I can look for ^\d+ to find paragraphs starting with a number, but I don't know how to specify the formatting constraint.

    It can't be done -- or rather, not in one go.
    A four-pass method is this: add Underline to all numbers. Remove underline from all numbers that are black. Check remaining underlined numbers. Remove underline from all numbers.
    You should do this, of course, with an attribute of which you are sure you didn't use!

  • Fastest way to loop through a group of strings

    I am trying to optimize a small class that loops through an array of strings and compares to see if another string equals one of the values, for example:
    String test = "this is test5";
    String array[] = {"test1","test2","test3, test4,test5,test6,test7,test8"};
    for(int i = 0;i < array.length; i++)
    if (test.endsWith(array))
    return array[i];
    }The array that I am using holds closer to 15 values, but this loop can be hit thousands of times a day.  My  question is, are there any faster ways to loop through multiple strings than using arrays?  How do array lists or maps compare?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    sarcasteak wrote:
    The array that I am using holds closer to 15 values, but this loop can be hit thousands of times a day. 15,000 comparisons a day is nothing. The following code does 15 million String compares in 188 ms.
    public class StrCmp {
      public static void main(String... args) {
        String[] arr = {"abc", "sdfasdlfkjasldfjalsdkfj", "234l2kjala34kh", "slkfjal3490u saf",
                        "234lkjasldfhk23k4jhasf", "23l4kjsf", "alsflsdjkf", "aslkdfajsdf3h", "zzzzz",
                        "uhuhuhuhuh", "uhu2huh234234", "n234aoiuf", "234lasdhvoaih3", "zoziucvoiu", "asdflsjfl"};
        long start = System.currentTimeMillis ();
        for (int i = 0; i < 1000000; i++) {
          String str = "qqq";
          for (String str2 : arr) {
            if (str2.endsWith (str)) {
              System.out.println ("match");
        long end = System.currentTimeMillis ();
        System.out.println((end - start) + " millis");
    My question is, are there any faster ways to loop through multiple strings than using arrays? How do array lists or maps compare?Before you worry about taking something simple that works and complicating it to make it faster, make sure there's a reason to do so.
    If you do in fact need to make it faster, there are several different things you could do, but which one is best depends on a number of factors specific to your particular requirements and use cases.

  • Search for a word in files

    Hi all,
    i need a help here..
    i am doing document search in my jsp application...i have all my files inside a folder..folder contains many folders and inside many files are there..if i specify one string it should display all the files that contains that word.
    for example if i search a word "welcome" if any file that contains welcome at any part of document it should specify that file along with the path and then the file should open when i click the link..pls tell me how to do that..

    Have a recursive method that takes as a parameter a File, an ArrayList of matches so far, and the String to search for. In your servlet, call it with a blank arraylist. Then iterate through the arrayList, and instead of outputting the path on the file system, output the URL.
         private void fileSearch(File currdir, ArrayList matches, String word) throws IOException{
              File[] fileset = currdir.listFiles();
              for (int i =0; i <fileset.length; i++){
                   if (fileset.isDirectory()) fileSearch(fileset[i], matches, word);
                   else{
                        BufferedReader reader = new BufferedReader(new FileReader(fileset[i]));
                        boolean found=false;
                        while (reader.ready() && !found){
                             String currline = reader.readLine();
                             if (currline.indexOf(word)!=-1){
                                  matches.add(fileset[i].getAbsolutePath());
                                  found=true;
                        reader.close();

  • How do you iterate through a string?

    Hi! How do I loop through a string of characters. My program needs to iterate through a string in order to do some calculations. Here is an example:
    <item>1</item>
    <description>This is an example.</description>
    How I iterate through description one character at a time.
    Thanks for your help!

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
    <xsl:template name="add-X">
    <xsl:param name="string" select="." />
    <xsl:if test="$string">
    <xsl:text>X</xsl:text>
    <xsl:value-of select="substring($string, 1,1)"/>
    <xsl:call-template name="add-X">
    <xsl:with-param name="string"
    select="substring($string, 2)" />
    </xsl:call-template>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>
    Create an file named TEST.xsl with the above code.
    <aaaa>ABCDE</aaaa>
    Create an file named TEST.XML with the above code.
    Create an RTF template with form field valus as
    <?import: file:///C:\Desktop\Sample RTF\TEST.xsl?>
    Note : here you have to point the xsl path where your TEST.xsl is located.
    Then create another form field with value
    <xsl:call-template name="add-X"> <xsl:value-of select="." /> </xsl:call-template>
    When you merge the xml and RTF , you will find the no of "X" equivalent to length of the string in <aaaa> tag in xml

  • Looping through an array to insert contents into an HTML table

    Im trying to loop through a String array and insert the contents into an html table, unfortunately my coding is only filling in the first row in the table and ignores any additional info. Im using webservices that is connecting to a table in the database.
    Info = ID + ";" + played + ";" + won + ";" + lost + ";" is the String im pulling into my client.
    <table border = "1">
    <tr>
    <td><b>ID</b></td>
    <td><b>played</b></td>
    <td><b>won</b></td>
    <td><b>lost</b></td>
    </tr>
    <%
    try {
         leglessclient.LegendServiceService service = new leglessclient.LegendServiceService();
         leglessclient.LegendService port = service.getLegendServicePort();
    String Info = port.displayLog();
    String[] log = Info.split(";");
    out.println("<tr>");
    for (int a = 0 ; a < log.length; a++) {
    for (int b = 0 ; b < 4; b++){
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    b++;
    out.println("</tr>");
    out.println("</table>");
    } catch (Exception ex) {
         // TODO handle custom exceptions here
    %>
    Any help would be greatly appreciated
    thanks!

    firstly, if you have multiple rows.. you need to start each row with <tr> and end with a </tr>. You just have one in the beginning and end,which will obivously give data in one row.
    out.println("<tr>");
    for (int a = 0 ; a < log.length; a++) {
    for (int b = 0 ; b < 4; b++){
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    out.println("<td>" + (log[a]) +"</td>");
    a++;
    b++;
    out.println("</tr>");

  • My search media bar brings up the stuff I want when I search for it but won't let me click on the results for anything.

    Hi guys, I've been having troubles with my search bar for searching media in itunes. It worked a while ago but now when I search it brings up results and the results I want but it won't let me click them for anything. I can't go to the song, album or artist or add it to the song queue. It's really annoying to go through my library and search for a specific song without using the search. Please Help!
    Thank You!

    you said you turned your phone off. was it a reboot, or an off? Ive noticed that if the memory is low and you have
    a lot of apps or processes running, it really causes the system lag. Try holding down the top button and home button at the same time. Then wait until it has powered down. In 60 sec or so, restart it the same way. Should fix your issue. There is an app I use called Lite Scan. It allows me to see what is running and it will free up 30mg at a time. Not much granted but enuf to keep the system from going to a crawl.
    as far as your device in itunes goes, open itunes, without your phone connected. look in the advance settings and make sure everything is as it should be. Back up your data and try again. good luck

  • How to loop through attributes

    Im trying to loop through some XML and use the two attributes
    name and href for each button im creating. so far all I have been
    able to do is onfuse myself, well not totally - I can pull the
    first name attribute from the firstChild. But I have not been able
    to successfully assign it to a button. I took out my button code as
    it was probably wrong. Heres what Ive tried...

    The arrays are built in an event, so before that event
    happens, they are undefined. After the event, you can access the
    arrays as usual. The trace(menus); call is before the
    myXML_xml.load("menu2.xml"); line, which triggers the loading, so
    it can't trace any values. It also wouldn't trace anything when
    placed directly after the load() call, because the loading will
    take some time until all data is loaded and the onLoad event is
    fired. That makes it a bit hard to use the data outside the event,
    because you must assert that it's loaded when used. The onLoad
    event is just perfect for that, so it should be done there, just
    after the loop through the xml nodes.
    For the submenus, the attached code will place the childnode
    data in subMenus. The arrays must be declared outside the event,
    otherwise they get deleted when the event finishes.
    cheers,
    blemmo

  • I need to loop through 1 table and read another until a value changes

    i need to read a table and sum the quantity field until a reason code changes.  how do I go about doing this?

    sort itab by reasoncode.
    Loop at itab.
    quantiy = quanity  + itab-quantity.
    at end of reasoncode.
    jtab-reasoncode = itab-reasoncodee.
    jtab-sum = quantity.
    append jtab.
    clear quantity.
    endat
    endloop.
    or
    sort itab  by reasoncode.
    loop at itab.
    at end of reasoncode.
    sum.
    jtab = itab.
    append jtab.
    endat.
    endloop.
    or
    let us say itab and jtab are two tables and you want to loop through itab and read jtab for reasoncodes.
    if jtab has only one entry for each entry in itab then use read else use loop.
    loop at itab.
    loop at jtab where reasoncode = itab-reasoncode.
    quantiy = quantiy + jtab-quanity.
    endloop.
    endloop.
    or
    loop at itab.
    read table jtab with key reasoncode = itab-reasoncode.
    if sy-subrc eq 0.
    endif
    endloop.

  • Search for one word in the adress bar with google when proxy is enabled.

    I have downloaded Firefox Version 30 and set up my company proxy. I use the address bar to search at google. Since I have configured the proxy I'm not able to search for only one word like 'fibonacci', if I search for 'fibonacci number' it still works.
    What's wrong?
    Many thanks.
    Cheers!

    You can use a keyword search to search via the location bar if the proxy doesn't report that a DNS look up has failed and Firefox thus doesn't send a search request.
    You can add a keyword to an installed search engine via Manage Search Engines if you click the search engines icon on the search bar.

Maybe you are looking for

  • BAPI / FM for payment proposal

    Hi, Can somebody tell me what is the BAPI/FM to Payment Proposal for Vendors only (I am talking interms of F110 transaction as you know there are 2 tasks 1 is payment proposal and the other one is Payment run per my requirement i have to do only Paym

  • Buying iPhone 5 from third party retailer w/ unlimited data

    I ordered an iPhone 5 in-store on the 21st since I couldn't find a way to pre-order and keep my unlimited data, even though I was paying full retail. My ship date isn't until October 19th, and that's a long time to wait. But I did find a local Radios

  • Can javascript call applet methods in explorer??

    Is it possible to call the start() and stop() methods of an applet in explorer 5? I know how to do it using netscape, document.appletname.start(); and that works, but I just get errors in explorer. Any suggestions?

  • Error when creating IMG CO Production Order

    Hello experts, In IMG I am trying to create new order type with Order category 4 (CO Production Order), however when using transaction KOT2_OPA Order type ZD00 Order Category 4 I get the following message Enter values in work area for non-key fields

  • FM Tu

    I heard that it was really bad for the Zen Micro, is it's If it is, can I buy the remote to make it better?