I need to search in a line a string but...

Hi there!, I hope you can help me with my problem...
I have a line from an html file like this:
String lineToSearch = "<b>This is a line with a different font<b>"
Well, I have a method that searchs a word or a character in the variable lineToSearch, and it works fine, but it doesn't know to differentiate between a normal character and the tags of an html file, if I want to search the word "font" in the variable lineToSearch, works good, but if the variable have a different line like this:
lineToSearch = "<font color = yellow>This is a line with a different font</font>"
find three time the word, how can I avoid the tags???

Ok the logic is to try to indentify in your string the <bla bla > statements and process only the value...one way (prob my implementation is not very nice but works ok for now
in a string like that :
"<font color = yellow>This is a line with a different font</font>"
we can identify 2 <bla bla> substrings and the value substring
The thing we want is the string between the > and the < right?
This is a line with a different font<So the logic of the code is convert string to char[] array .search the indexes of the < and > characters
in a string like that < blabla > adfasdfasdf </blabla> searching for < and > will give as 4 indexes
so using the indexes of the first > and the second < as they appear in the string we give as the value only...after that you can call your method to process the string
public String giveSubString(String s) {
s="<font color = yellow>This is a line with a different font</font>";
char[]r=s.toCharArray();
Vector indexes= new Vector();
for(int x=0;x<r.length;x++)
if(r[x]=='<'||r[x]=='>')
indexes.add(new Integer(x));
String s1 = s.substring(((Integer)(indexes.get(1))).intValue()+1,((Integer)(indexes.get(2))).intValue());
System.out.println(s1);
return s1;
This logic wont work for a string like that <bla><c>sadfsadfasdf</c></bla> but you can easily modify the logic with the indexes
I hope it helped...if your need further assistance dont hesitate to email me ..because I cant visit the forum so often
[email protected]

Similar Messages

  • I want to deployment WSUS for our company. So I need step by step guide line with screenshot and video link

    I want to deployment WSUS for our company. So I need step by step guide line with screenshot and video link.
    Thanks,
    Qamrul

    I was more interested in writing a script in PowerShell to automatically deny Itanium server updates.
    Would you happen to know a good article on this?
    I believe this topic has been discussed in this forum, so I'd start by searching the forum.
    Beyond that, your best friend in PowerShell script efforts is going to be CodePlex. There may be one posted there, already written.
    As a technical reference, you'll need to be familiar with the WSUS API, and the
    Software Development Kit is available on MSDN.
    You can definitely do this with PowerShell. (I actually do it with a feature of SolarWinds Patch Manager which does it via an API call.)
    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

  • Search log file line entry (date and string)

    I use powershell 4 and I need to search from a text file if it has a line that contains a date like this '2014-02-12' AND the same line contains some text string like
    'execution successful', that line contains something else but those are the important things. I am a bit lost, I managed to parse it with select-string and split commands but it comes quite ugly and long code. Can I just use regex, something
    like this:
     select-string -Pattern '(2014-02-12)(execution successful)' -Path $myfile
    I want a single line output and then I make an IF sentence that checks if it exists and if it does not, then I create an email alert.

    Hi,
    Here's one possibility:
    $strFound = $false
    $dateStr = '2014-02-12'
    $searchStr = 'execution successful'
    Get-Content .\inputFile.txt | ForEach {
    if ($_.Contains($dateStr) -and $_.Contains($searchStr)) { Write-Host "Found - $_" ; $strFound = $true }
    If ($strFound -eq $false) { Send-MailMessage }
    Don't retire TechNet! -
    (Don't give up yet - 12,575+ strong and growing)

  • How to find end of the Page in Crystal ? or I need to add one Horizontal line at the end of the page.--- URGENT HELP NEEDED

    Hi friends,
    I need to add one horizontal line  for the detail section at the end of the page.
    I tried to put that line in page footer and i tried with Box also. Both are not properly working. Some space problem is coming.
    Is there any feature to find end of the Page.
    I want report format like this.
    set id  |  set name |  date  Name
      1         x           dddd   vijay
                            dddd   sarathi
                            dddd    reddy
    (End of the page)
    Thanks in advance...
    vijay.

    Do you know how many detail records are showing up per page?
    If you do - you could create a Details B section that is suppressed except for on Record N (where N is a counter, and N is the last Detail record that will show up on a page).
    The Page footer is indeed built so that it will be rendered at the bottom of your physical page of paper.

  • I have a macbook pro 15 inch mid 2012 and I want to change the hard drive, what specifications do I need to search for?

    I have a macbook pro 15 inch mid 2012 and I want to change the hard drive, what specifications do I need to search for?

    Does a Seagate - 1TB Internal Serial ATA III/Serial ATA II Solid State Hybrid Drive for Laptops - Multi with the following specifications may work??
    Height
    4 inches
    Width
    2.75 inches
    Weight
    3.5 ounces
    Color Category
    Multi
    Minimum System Requirements
    PC: Windows XP, Vista, 7 or 8; MacBook®, MacBook Pro or Mac Mini: Intel®
    processor; OS X; Linux; internal Serial ATA III or Serial ATA II support

  • How do I copy a few lines from a pdf document to a Word document?  I'm not looking to convert the whole document, just need to copy a few lines here and there.

    How do I copy a few lines from a pdf document to a Word document?
    I'm not looking to convert the whole document, just need to copy a few lines here and there.
    ps.  Wow, what a user UNFRIENDLY site this is!

    In most cases you can just select the text and copy/paste. You can do that unless the file is a picture/scan.

  • How can I search the last line in an internal table?

    How can I search the last line in an internal table?
    With a describe?? If it is , how can I do that?
    Thanks!!

    Hi shilpa,
    it seems to be you are NEW to SDN. welcome. if you want to get solutions to your Questions, you have to post a NEW thread.dont use the existing thread to post your question.
    any way i am giving you the solution for your question
    LOOP AT ITAB WHERE F1 = <SOME VALUE>
                       F2 = <SOME VALUE>.
    ENDLOOP.
    IF SY-SUBRC = 0.
      ITAB WILL HAVE THE LAST RECORD which satisfying the given criteria in WHERE clause of LOOP.
      write itab <--this ITAB will have the last record.
    ENDIF.
    regards,
    Srikanth.
    Message was edited by: Srikanth Kidambi

  • I have ca. 30 pdf documents I need to search for keywords; how can I do on my MAC?

    I have ca. 30 pdf documents I need to search for keywords; when I open these documents in Adobe Reader on my MAC, it shows a Search tool; however, when I search for keywords I know are in the document, none are found.  How can I do a keyword search?

    Do you know if the text has been OCR recognised? Are the original documents "scans"?
    An easy way to find out, if you can select an individual word or letter? If you are selecting a whole block of text then the document will need to be put through Optical Character Recognition (OCR) software first to enable you to keyword search.

  • Using Numbers, I need to time-stamp each line in a table for when it was entered

    I need to time-stamp each line in a table for when it was entered.
    I have a formula which is
    "=IF(F18="","",NOW())"
    it gives me the answer I want, but every time I edit any data in the formula is recalculates the date/time to reflect the most recent edit. I do not want to do this. I am open to any and all solutions including using a script. I do not really know anything about scripts except that they are really easy to use once it's written.
    I have a formula i use in excel but it requires circular references in excel. I tried using this formula in numbers but I get the error that says I cannot reference a cell that references back to the cell i’m inputting the formula into (circular reference. It is easy to use in excel just by limiting the # of iterations in preferences. I can’t seem to find any such preference in numbers. Do you know of one? here is the formula:
    "=IF(D4=”",”",IF(B4=”",NOW(),B4))"
      I use it to time stamp each line in a spreadsheet. It is the only way to keep all the previous line from recalculating everytime I add a new line. If I can’t use this formula, do you know of a way to timestamp each line without having it update everytime I add a line or edit the form?
    Thanks in advance- I know this isn’t exaclty an easy question but I have honestly looked everywhere
    emely

    Hi Emely,
    Check the Insert menu:
    The highlighted item is slightly misnamed, requiring a bit more than a simple selection (or keypress combination*) to act as a time stamp.
    Simply choosing the menu item willproduce the result shown in A2: A time and date value is entered, but only the Date part is displayed.
    Setting the cell format to Date and Time, with both parts displayed (as I've done in column B) does show both parts of the Date and Time value, but as you can see, the time part is set to midnight, as it is in any cell where you have entered only the Date part of a Date and Time value. The date was entered here in the same manner as in A3.
    To enter both the current Date and current Time, the process has a few more steps:
    Select the cell
    Go Insert > Date & Time
    Before confirming the entry, double-click the cell (now showing the Date) to open this small dialogue:
    Click the pop-up menu under Choose Date format:
    Choose the last item in the list.
    Results as shown in A4 and B4 of the table above.
    Regards,
    Barry
    •Regarding the KB shortcut shown: The Mac OS lets you define a KB shortcut for any top-level menu item. The one in the menu is a user-defined keypress combination, made to be easily remembered, not to be physically convenient to use. If doing your own, you may want to try for something eassier to get your fingers on.

  • I want to perform bidirectional i/o using a pci-6534.The problem is that i need to use the same lines for i/p and o/p. is that possible?

    I want to perform bidirectional i/o using a pci-6534.The problem is that i need to use the same lines for i/p and o/p. is that possible? And if it is how an i doing this?

    Hi I Pant,
    The idea that crossed my mind was to tie each of the lines coming from/going to "your device" to two of the DIO lines. Configure one these two ports as input, the other as output.
    When you want to read the state of the line, read from the line configured as input. Similarly, use the other port when it is time to write.
    Provided "your device" uses tri-state drivers/receivers, or can be used in a "wired-OR" configuration, this may work.
    What is "your device"?
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • GREP search for single line paragraphs, CS3

    I need to find all single line paragraphs, apply a paragraph style to them and apply that style's "next style" to the next paragraph.
    Is there any way to do this using GREP?
    Thanks

    This script will do what you ask. Just change the name of the head paragraph to whatever yours is in line 11:
    //DESCRIPTION: Apply Head Style to single-line paras with Next Style in Selected Story
    (function() {
      if (app.documents.length > 0 &&
            app.selection.length == 1 &&
              app.selection[0].hasOwnProperty("baseline")) {
      var myStory = app.selection[0].parent;
      var myParas = myStory.paragraphs;
      for (var j = myParas.length - 1; j >= 0; j--) {
        if (myParas[j].lines.length == 1) {
          myParas[j].appliedParagraphStyle = "H1";
          try {
            myParas[j+1].appliedParagraphStyle = myParas[j].appliedParagraphStyle.nextStyle;
          } catch(e) {} // last para has one line, so ignore
    } else {
       // No document open
       alert("Please select some text and try again.");
    To use the script, copy it from here into an ExtendScript Toolkit document (you'll find that in the Adobe Utilities folder). Save the document into an appropriate folder and run the script from the Scripts panel with a live insertion point in the story.
    To work out where to save the script, open the Scripts panel and then use Reveal in Explorer to find the User Scripts Panel folder.
    If your heading style isn't at the top level in your Styles panel, temporarily move it there.
    Dave

  • Need to cancel the schedule line

    Dear all,
    Please advice me, for stock model meaning SO stock is not tied with SO, it will be in Unrest, stock. this scenario i need to cancel the Schedule line qty for confirmed SO & need to assign for Unconfirmed SO which delivery date is near to the Current date.

    Hi
    Backorder processing helps you in this event. Use transaction V_V2. In that give the material number and plant.In the options select sales document and uncofirmed documents required.and below select the priorities of sales document and deliveries.
    Reward if this helps.
    Regards
    Simu

  • Needed to search a file

    Hi All ,
    I need to search a location of file mybuild.properties from unix. How cvan i ?
    Can any one guide me on this. ?
    Thanks in Advance
    Sachin

    find / -name 'mybuild.properties'
    This syntax searches starting from /
    If you want to start from any other directory, please replace / with that directory.
    Also you can try to use locate command, which is available in some Unices.
    Cheers,
    Alin

  • I need to know how many  lines a cursor returns

    Hi,
    I need to know how many lines a cursor will return without counting it within a loop or putting a count clause within the cursor . Is there a way to do ?

    Please post this question in the database forum for an appropriate response: General Database Discussions
    Regards,
    OTN

  • ALV Output - Need to show count of line items based on 1 key field.

    Hi All,
           In my prog i need to show an ALV ouput which is having Matnr,Material type and Division . MATNR is the key field. I need to show how many line items are present against a  particular MATNR in that ALV ouput itself. Not in the top of page. I think there might be some field in SLIS which can be use for the same. If any one has come across such a requirement then please revert back.
    thanx,
    Shyam.
    PS: Useful answers will be rewarded.

    Ok, so we are back to using the COUNT field and now using the SORT functionaity, the SORT will allow us to subtotal by MATNR.
    REPORT  zrich_0001.
    * Global ALV Data Declarations
    TYPE-POOLS: slis.
    * Internal Tables
    TYPES: BEGIN OF talv ,
           matnr TYPE mara-matnr,
           mtart TYPE mara-mtart,
           spart TYPE mara-spart,
           count TYPE i,
           END OF talv.
    DATA: ialv TYPE TABLE OF talv WITH HEADER LINE.
    DATA: fieldcat  TYPE slis_t_fieldcat_alv.
    DATA: sort     TYPE slis_t_sortinfo_alv.
    DATA: layout    TYPE slis_layout_alv.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM call_alv.
    *      Form  GET_DATA
    FORM get_data.
      SELECT matnr mtart spart INTO TABLE ialv
                FROM mara UP TO 500 ROWS.
    ENDFORM.                    "GET_DATA
    *  CALL_ALV
    FORM call_alv.
      PERFORM build_field_catalog.
      PERFORM build_sort.
      layout-countfname = 'COUNT'.              "<-----  HERE
    * Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_sort     = sort
          is_layout   = layout
          it_fieldcat = fieldcat
        TABLES
          t_outtab    = ialv.
    ENDFORM.                    "CALL_ALV
    * BUILD_FIELD_CATALOG
    FORM build_field_catalog.
      CLEAR: fieldcat. REFRESH: fieldcat.
      DATA: tmp_fc TYPE slis_fieldcat_alv.
      tmp_fc-reptext_ddic = 'Material'.
      tmp_fc-fieldname    = 'MATNR'.
      tmp_fc-tabname      = 'IALV'.
      tmp_fc-outputlen    = '18'.
      APPEND tmp_fc TO fieldcat.
      tmp_fc-reptext_ddic = 'Material Type'.
      tmp_fc-fieldname    = 'MTART'.
      tmp_fc-tabname      = 'IALV'.
      tmp_fc-outputlen    = '4'.
      APPEND tmp_fc TO fieldcat.
      tmp_fc-reptext_ddic = 'Division'.
      tmp_fc-fieldname    = 'SPART'.
      tmp_fc-tabname      = 'IALV'.
      tmp_fc-outputlen    = '2'.
      APPEND tmp_fc TO fieldcat.
      tmp_fc-reptext_ddic = 'Count'.
      tmp_fc-fieldname    = 'COUNT'.
      tmp_fc-tabname      = 'IALV'.
      tmp_fc-outputlen    = '5'.
      tmp_fc-do_Sum       = 'X'.
      append tmp_fc to fieldcat.
    ENDFORM.                    "build_field_catalog
    *&      Form  build_sort
    *       text
    FORM build_sort.
      DATA: tmp_sort TYPE LINE OF slis_t_sortinfo_alv.
      CLEAR sort. REFRESH sort.
      CLEAR tmp_sort.
      tmp_sort-fieldname = 'MATNR'.
      tmp_sort-tabname   = 'IALV'.
      tmp_sort-up        = 'X'.
      tmp_sort-subtot    = 'X'.
      APPEND tmp_sort TO sort.
    ENDFORM.                    "build_sort
    Regards,
    Rich Heilman

Maybe you are looking for

  • Homesharing with apple tv

    while homesharing with my apple tv will i be using up my internet data?

  • Transfering data to new G5

    Pardon my ignorance but - I have an iMac G3 and would like to purchase a new G5 and I was wondering if I could simply connect the two via the USB port and tranfer files from old to new. thanks for your help, Rick

  • Cannot Clear Critical Alert for Physical Standby Databases

    10.2.0.4.0 Grid Control monitoring 10.2.0.4.0 databases and standby databases with 10.2.0.4.0 agents. The standby databases are running on Xen guests. The O/S is Red Hat 4 Advanced Server. I had a failure of Xen guest on Saturday that caused me to ha

  • IOS 6 GB & amplitube problems

    I know other people have commented on the problems they've experienced with garageband on iOS 6 when using irig. I have the same issue with the app now rendered unusable due to the hideous amounts of feedback when using irig and a guitar. However, un

  • JSTL sql:param has problems

    a.jsp?id=1&id=2&id=3 <c:set var="a"> ${fn:join(paramValues.a,",")} </c:set> when print out the value of a ${a} is: 1,2,3 <sql:update> update my set t=1 where id in(?) <sql:param>${a}</sql:param> </sql:update> when this happens,hope have 3 datas was u