How to Look at current Token

When using the tokenizer in Java I see that you can count tokens "countTokens() " , see if a string has more tokens "hasMoreTokens()", etc. But how do you work with the current token?
For example:
while ((str = in.readLine()) != null )
     StringTokenizer tokens = new StringTokenizer(str);
     while (tokens.hasMoreTokens())
          System.out.println( tokens.nextToken() + "\n" );
          //tokenStr = tokens.nextToken();
          count++;
          //if (tokenStr.equals("<body>"))
          //     bodycount++;
         }I can count all the tokens in the string but how can I count the tokens "<body>"?
Any help please
eddiemjm

You are almost there. Trywhile ((str = in.readLine()) != null )
     StringTokenizer tokens = new StringTokenizer(str);
     while (tokens.hasMoreTokens())
          tokenStr = tokens.nextToken();
          System.out.println( tokenStr + "\n" );
          count++;
          if (tokenStr.equals("<body>"))
               bodycount++;
         }Note the change and move of the println() call.

Similar Messages

  • How to get the current week from sysdate?

    Hi sir,
    i want to know how to get the current week from sysdate?
    thanks

    Hi Nicolas
    It seems you like to check my post and also make commend ;) thanks for your attention
    Have you ever read the posts above and given solutions ?Yes, I did
    Have you read the docs ? Yes, I checked
    What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
    => Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
    So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
    Hope my answer could satisfy you..
    One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
    I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
    Thank you
    Regards
    Helios

  • How to get the current date and compare dates

    hi
    does anyone know how you would get the current date?
    furthermore, how to compare the current date with a past date to see how many days or months have past since then?
    thanks

    have a look at the Date class. new Date() creates an object containing the exact date and time at creation time. (Date).getTime() might be useful for comparing two dates. GregorianCalendar might be useful, too.

  • How do you get the personas to work when you scroll the pointer over it? i cant get this to work. i have to wear it just to see how it looks

    when you mouse over the persona it should wear it so you see how
    it looks. my wont do anything. i have to wear it to see if i like it and
    if not then i have to remove it. is there something i need to enable
    to get this to work. im using firefox 4 with windows xp.

    Previewing a persona only works on sites that are white-listed via an allow exception.
    You can see the permissions for the domain in the current tab in:
    * Tools > Page Info > Permissions > [X] Install Extensions or Themes
    * Tools > Options > Security : "Warn me when sites try to install add-ons": Exceptions
    Make sure that you do not use [[Clear Recent History]] to clear the 'Site Preferences'.
    See http://kb.mozillazine.org/Themes#Lightweight_theme

  • HOW TO KEEP YOUR CURRENT CUSTOMER

    THIS IS NOT EVEN AN IDEA.  THIS IS JUST SIMPLE BUSINESS 101.   I BROUGHT THIS ISSUE 2 YEARS AGO AND ENDED UP TALKING TO A NICE SUPERVISOR THAT UNDERSTOOD MY POSITION AND ENDED UP WITH THE SAME DEAL NEW CUSTOMER WILL GET FOR CURRENT CUSTOMER WHO WANTS TO RENEW THEIR CONTRACT FOR ANOTHER 2 YEARS!!!.  AS WE ALL KNOW VERIZON HAVE A GREAT DEAL FOR NEW CUSTOMER BUT THIS DEAL IS NOT AVAILABLE FOR THEIR 2 OR 10 YEARS CUSTOMER THAT WANT TO RENEW THEIR CONTRACT?????  I UNDERSTAND THE IDEA AND FINANCIAL PART OF DOING THAT BUT THEY ARE WRONG. BECAUSE MY 2 YEARS CONTRACT EXPIRED IN 4 MONTHS AND IF THEY DON'T GET ME THE SAME DEAL THEY ARE OFFERING TO THEIR NEW CUSTOMER, I WILL BE LOOKING FOR THEIR COMPETITOR.  I MEAN THEY NEE DOT ADD IN THEIR DICTIONARY WHAT LOYAL CUSTOMERS MEANS OR LOOK INTO HOW TO KEEP YOUR CURRENT CUSTOMERS, I MEAN I MIGHT NOT EVEN CARE IF THEY STOP SENDING ME ALL THESE ADS ALMOST EVERYWEEK ABOUT ALL THESE GREAT DEALS NEW CUSTOMERS GET, I FEEL LIKE CHEATED....BY THE WAY, I HAVE BEEN WITH VERIZON FOR 6 YEARS NOW....AND I AM CERTAIN, I AM NOT THE ONLY ONE, IF YOU ARE CURRENT CUSTOMER LIKE ME YOU WILL CERTAINLY WILL AGREE IF YOU SEE WHAT THEY ARE OFFERING TO NEW CUSTOMER....YOU WILL FEEL LIKE BETRAYED.....

    agee66 wrote:
    ... Why treat long time loyal customers who want to re-up with Verizon worse than potential new customers?  Discounts should be for all customers, especially long time loyal ones
    If everyone gets the same low prices, all of the time, forever, then what exactly is your definition of "discount"?

  • How do we know currently active call time in 6680?

    How do we know currently active call time? Whenever we receive or make a call, how can we know the call duration in Nokia 6680?

    Hello!
    Just take a look on page 27 of Manual.
    Recent calls: Connect -> Log -> Recent calls.
    Steps to activate call duration as follows: Connect -> Log -> Options -> Settings -> Show call duration. Select Yes.
    Andrey
    6150, 8310, 2100, 6310, 6310i, 6230, 6600, 6630, 6700, E60, N80, E61, N93
    N95, E61i, E71, E72,8600, 5800, N8

  • How can I retrive current user information in Content Server's presetation template?

    We need to determine current user is the item's created user or not, so we want to know how to do this?
    we can use <pcs:if expr="'Luke' == createdBy">....,but the 'Luke' is static string,
    so, how can I retirve current user name in Content Server's presetation tempalte?

    I don't know that this is possible in a direct fashion. (and, btw - thank you for asking this question. I realized we'll eventually need exactly the same thing so looking at this helps me as well :).
    I'm quoting dev support from another posting on making community comparisons dynamic:
    "This won't work because the pcs: tags are evaluated on the Content Server during the publish operation, resulting in a static HTML file that still contains the raw pt: tags. This same HTML file will be displayed in all of your communities. The pt: tags are evaluated on the portal server right before it returns content to the user, this allows the single HTML file to show a different name in each community. "
    So the gist of things is that content server acts dynamic to you and I through the editing UI, but is really publishing static content. The values at run-time are not directly available to the PCS operators because...well...the PCS stuff is already done. It produced the static HTML showing up in the portlet.
    There appear to be two immediate options:
    Use the transformer tags to publish the user's name at run-time. Have the PCS and Transformer tags write their values into javascript strings and then compare this client-side. My response: "meh" Not for the purist, but I'm so far down the non-purist path at this point it just doesn't matter any more to me. Simple and to the point, but has known risks. Probably the easiest way to go.Publish your page as ASPX or JSP and then use the EDK server-side to manage the comparisons. Definitely more server-centric, but does require you do a quick bit of content server configuration. Just set the publishing target for the portlet to a directory on a web server and then set the publishing file extension to .ASPX or .JSP. I've done this with ASP and it works nicely. :)Not entirely the answer you or I were looking for, but I think it makes sense.
    The PT transformer tags you'll want if you go with option (1) are:
    Get the user's full name
    <pt:userinfo xmlns:pt="http://www.plumtree.com/xmlschemas/ptui/" name="FullName" />
    Get a custom user setting "myUserSetting"
    <pt:userSetting name="myUserSetting" xmlns:pt="http://www.plumtree.com/xmlschemas/ptui/" />
    Plumtree - am I off base on this one?
    Thanks,
    Eric

  • How can i specify current directory path of wsusscn2.cab

    SCRIPT:
    How can i set current directory file path of wsusscn2.cab where i placed this vbscript, instead of going to c:\wsusscn2.cab.
    =======================================================================
    Dim fso
    Set wshNetwork = CreateObject("WScript.Network")
    strUser = wshNetwork.Username
    Set fso = WScript.CreateObject("Scripting.Filesystemobject")
    Set f = fso.CreateTextFile(".\Missing Patch Details\" & wshNetwork.ComputerName & "_missing_patches.csv", 2)
    Set UpdateSession = CreateObject("Microsoft.Update.Session")
    Set UpdateServiceManager = CreateObject("Microsoft.Update.ServiceManager")
    Set UpdateService = UpdateServiceManager.AddScanPackageService("Offline Sync Service", "c:\wsusscn2.cab")
    Set UpdateSearcher = UpdateSession.CreateUpdateSearcher()
    WScript.Echo "Searching for updates..." & vbCRLF
    UpdateSearcher.ServerSelection = 3 ' ssOthers
    UpdateSearcher.ServiceID = UpdateService.ServiceID
    Set SearchResult = UpdateSearcher.Search("IsInstalled=0")
    Set Updates = SearchResult.Updates
    If searchResult.Updates.Count = 0 Then
        WScript.Echo "There are no applicable updates."
        WScript.Quit
    End If
    WScript.Echo "List of applicable items on the machine when using wssuscan.cab:" & vbCRLF
    For I = 0 to searchResult.Updates.Count-1
        Set update = searchResult.Updates.Item(I)
    f.WriteLine update.Title
    'WScript.Echo I + 1 & "> " & update.Title
    Next
    WScript.Quit
    ==========================================================================
    prakash

    Just remove the c:\ and it will be looked for in the current directory.
    If you want the script how get the script path and remove the file name or use the shell
    currentFolder = CreateObject("WScript.Shell").CurrentDirectory
    ¯\_(ツ)_/¯

  • How long is my auth token valid?

    In php when I call $session->getAuthenticationToken, I get an authentication token returned to me.   How long is that auth token valid for?
    I ask because I was reading the docs on webcamPublisher and under connectSession it says: "re-sessioning of components is not supported.".  So if my session expires and I want to connect again then in addition to creating a new session I also need to destroy my old webcamPublisher and create a new one.   Am I understanding that correctly?
    Thank you,
    Eric

    A room session ends a few minutes after all users have left.
    Currently there is no way to make the duration of a token, but you can invalidate the session by calling AccountManager.invalidateSession(session).
    Note that invalidating the session doesn't stop users that are already in a room, only users entering or re-entering the room.
    I think we should really provide a "stop room" method, that kicks all users out of the room and invalidate the session. It's in our todo list but not too hight in priority right now.

  • как вернуть текущий ключ how to return the current key

    подскажите как вернуть текущий ключ виндовс.так как диска востановления нет
    tell me how to return the current key vindovs.tak as repairing disk no

    Hi Xolostjak,
    Welcome to the HP Community, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    It sounds like you are looking to to restore your original version of Windows because the Recovery Disk wasn't working. Is that correct? Since this is an English forum can you please respond back in English.
    I will be happy to help but I need some more information. I will need to know what your operating system is? What is the product number for your notebook?
    Thank you,
    Please click “Accept as Solution ” if you feel my post solved your issue.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Thank you,
    BHK6
    I work on behalf of HP

  • How to pass credentials/saml token access sharepoint web service ex:lists.asmx when sharepoint has single sign on with claims based authentication

    How to pass credentials/saml token exchange to the sharepoint web service ex:lists.asmx when sharepoint has single sign on with claims based authentication 
    Identity provider here is Oracle identity provider 
    harika kakkireni

    Hi,
    The following materials for your reference:
    Consuming List.asmx on a claims based sharepoint site
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/f965c1ee-4017-4066-ad0f-a4f56cd0e8da/consuming-listasmx-on-a-claims-based-sharepoint-site?forum=sharepointcustomizationprevious
    Sharepoint Claims based authentication and Single Sign on
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/2dfc1fdc-abc0-4fad-a414-302f52c1178b/sharepoint-claims-based-authentication-and-single-sign-on?forum=sharepointadminprevious
    Sharepoint Claim Based Authentication Web Service issuehttp://social.msdn.microsoft.com/Forums/office/en-US/dd4cc581-863c-439f-938f-948809dd18db/sharepoint-claim-based-authentication-web-service-issue?forum=sharepointgeneralprevious
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to change default Current Flag values for SCD2?

    I'd be curious to find out how to change default Current Flag values for SCD2 (instead of 0/1 to use N/Y)
    Probably I can change IKM module .... is there another way?
    Thanks

    Hi,
    You need change the IKM. This values are hardcode in the IKM.
    You can create a new IKM and the values used are a options of the IKM.
    Regards
    Edited by: Uthred on May 18, 2009 4:27 PM

  • How to get the device token in windows phone 8 sliverlight application?

    Hi,
    I am developing a windows phone 8 silverlight application . For my application I want to add push notification service , for this service I have to call one web service in my app . This api requires device token , device id ..etc , I am able to get the all
    the things except devicetoken .
    How to get the device token of a device ?
    any help?
    Thanks...
    Suresh.M

    Most probably device token is the push channel url which is returned by MPNS when a request is made to it.
    Step 3 here: Push notifications for Windows Phone 8
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • How to get the current path of my application in java ?

    how to get the current path of my application in java ?
    thanks

    To get the path where your application has been installed you have to do the following:
    have a class called "what_ever" in the folder.
    then you do a litte:
    String path=
    what_ever.class.getRessource("what_ever.class").toString()
    That get you a string like:
    file:/C:/Program Files/Cool_program/what_ever.class
    Then you process the result a little to remove anything you don't want:
    path=path.substring(path.indexOf('/')+1),path.lastIndexOf('/'))
    //Might be a little error here but you should find out //quickly if it's the case
    And here you go, you have a nice
    C:/Program Files/Cool_program
    which is the path to your application.
    Hooray

  • How to look for the Table Name

    Hi Friends,
    Sometimes we need to download the table for the desired information if the same is not available from a particular report. How to look for the table name? Is there a report or a particular feild, where we can find the name of the particular table?
    Thanks for the assistance.
    Regards

    Hi Friend,
    If you want to see the structures then go to SE11. Sometimes it happens that you cannot find the table names but only fields. In such case, if you want to find the Table names which is not available, then go to SE90.
    Abap Dictionary > Fields > Table Fields.
    Now Enter the Field name in Right Hand Side of the screen then Execute. You will see the all tables by which that Fields are used.
    Regards,
    Jigar

Maybe you are looking for

  • Message ID in Message Mapping

    Hello everyone, I have a BPM that executes an ABAP Proxy, my problem is that I need to send in the ABAP Proxy strcuture the Unique Message Id that the BPM has in XI, I don't know if I can obtain this field in Message Mapping and map it to the ABAP Pr

  • Error 4280 (again!)

    I've seen alot of topics on this, but I could use some help here. My Burning thru itunes used to work well, but now everytime i try and burn a CD it says its starting, then a few seconds go by and it stops and says Error 4280. Here are my diagnostics

  • How to remove an app from my printer

    How to remove an app from my hp5510 printer

  • How to set iframe src from java dynammically

    Hi, Iam calling a servlet from jsp and servlet calls the databse query and returns the value, in my jsp i have ifrme, i want to change the source of iframe from java depends on the result from database , and the result must display on the iframe can

  • I can't open a project I have worked on.

    It's an "iMovie Project" file (273MB), I managed to save it to my desktop, but can't seem to open it on iMovie. (I never exported it and would like to do that now). Any help would be much appreciated!