Terminating input with a full stop ' . '

Hi
I am writng some code that enables input to be broken into strings using a StringTokenizer then stores the strings in the vector. I am only interested in the first sentence and therefore want to terminate input immediately prior to the pint where a user enters a full stop '.' (if they enter a full stop)
This is the code so far,
public static void main (String [] args ) throws IOException {
     BufferedReader keyBoard = new BufferedReader( // creates a BufferedReader to store input                                                  
     new InputStreamReader (System.in)); // sets up streams
     String sentenceForward;
     System.out.println ("Please enter a sentence"); // prompts the user to enter a sentence
     System.out.println("");
     sentenceForward = keyBoard.readLine(); // reads the sentence inputted and stores it in a variable
     StringTokenizer st = new StringTokenizer (sentenceForward); // Breaks the sentence into tokens
     Vector v = new Vector (); // Constructs an empty vector
     String w;
     while (st.hasMoreTokens()) {
          w = st.nextToken();
          v.add(w.toLowerCase()); // creates a vector containing the user input
                                        // converted to lower case
     } // end while
Any help would be appreciated...
Thanks

Break off the first sentence first...
sentenceForward = keyBoard.readLine(); // reads the sentence inputted and stores it in a variable
sentenceForward = sentenceForward.substring(0, sentenceForward.indexOf('.')+1); // only keep up to and including first .
StringTokenizer st = new StringTokenizer (sentenceForward); // Breaks the sentence into tokens

Similar Messages

  • Terninating input with a full stop

    Hi
    I have written some code that allows a user to input a sentence using system.out.println and a buffered reader. The input is then stored in a vector using a StringTokenizer.
    I only want to store input entered up until a full stop(.) is entered by a user - can anyone help with any suggestions??
    Thanks....

    Show your code, that makes it easier to see what you are doing and what you want to achieve.

  • Email will not send to email address with a full stop within the name as it drops the last name ie jim.smith@.... changes to jim@....

    I am trying to reply or send a email to a email address that has a full stop in the username ie [email protected] When the email sends it drops the surname ie [email protected] I have checked the address from the reply and it is correct even if I type it in it still has the same issue. Does anybody have an idea of what I can do. Thanks

    The Addons support forum is over here:
    https://forums.addons.mozilla.org/
    Separate forums with separate login credentials. Unfortunately each forum under mozilla.org was started at a separate time ''[years apart]'', by a different project group, and user credentials weren't centralized. About a year ago the plan was to have [https://login.persona.org/ Mozilla Persona] ''[a centralized login system]'' "consolidate" all the different Mozilla domain login credentials for users, but I haven't seen that even start to happen yet.

  • Full Stop Replaced with UnderScore when downloading

    I've been having an issue download files from IE9.
    1. Any file i download has the full stop replaced with an underscore before the file extension.
    2. Some downloads try downloading a PHP file instead of th requested file.
    3. The Download prompt bar remains on the screen, until i click Open or Save.  Cancel does not remove the download bar.
    4. The first attempt always fails and reports that the file couldn't be downloaded and i have to click retry for every file.
    I have tried removing and re-installing IE and running with Add-ons disabled but still having the same issue.
    Any help, suggestions or solutions would be appreciated.

    Any help, suggestions or solutions would be appreciated.
    http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/the-dot-in-download-filenames-always-gets-changed/57b6b7c4-75c3-4a7a-ad45-1debfbe5ebae
    I still think diagnosis may be required but it appears that a workaround has been found.
    In another thread a safe mode boot was found to be a workaround, doubling my conviction that diagnosis would be required.
    http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/why-does-internet-explorer-replace-with/7cec07db-9392-4064-9eb0-f1be6a158a7b
    FWIW my guess for that one would be the user's AV package.   <eg>
    In fact, perhaps that interferer would step out of the way when   Protected Mode   is unchecked?   Etc.
    Good luck
    Robert Aldwinckle

  • When typing an email I need each new sentence to automaticaaly start with a capital letter. At present after a full stop the new sentence automatically starts with a lower case letternot an upper case one

    When typing an email new sentences do not automatically start with a capital letter after a full stop.
    Surely this should happen automatically without the need for me to touch the capital letter icon.
    peter

    peterlesliebabani wrote:
    i called apple and the guy i spoke to said it is probably a VIRUS and it will be corrected on the next update!
    Either you didn't actually call Apple, and got some tech support scammer instead (calling the first number that pops up on a Google search for "Apple support" can give you some bad numbers), or the Apple tech you spoke to didn't know what he's talking about. It's not a virus.
    As for the problem, if you have enabled auto-capitalization and the problem continues, first try resetting your device. Press and hold both the home button and the sleep/wake button for about 10 seconds, until the screen turns off. Ignore the slider that will appear. Release the buttons, then press and hold the sleep/wake button until the Apple logo appears. This is the equivalent of a reboot, and should not affect your data or apps.
    If that doesn't help, try restoring your device from backups, and if that doesn't help, restore it to factory settings (ie, do not restore a backup). See:
    http://support.apple.com/kb/ht1414
    If none of that helps, the issue is caused by some kind of hardware problem, and the device will need to be repaired or (more likely) replaced.

  • How do you set a default on the Mac that automatically starts a sentence with a capital letter after a full stop? Thanks guys....

    How do you set a default on the Mac that automatically starts a sentence with a capital letter after a full stop? Thanks guys....

    I use SpellCatcher.  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 

  • Can pages be set to full stop with a double space tap

    Hi,
    Does anyone know if you can set pages (or use an app) to place a full spot after a double space bar tap?
    Thanks

    In text replacement (System Preferences > Keyboard > Text), one cannot use a leading space in the Replace column, thus eliminating double-space as a character replacement combination. Depending on the internationality of your keyboard, there may be alternative tandem characters that when configured in the text replacement facility — will offer a full-stop as replacement.
    I do not use third-party tools for text or keyboard mapping, so cannot comment on that viability for your goal.

  • Internet address with full stops (periods) why error????

    Am I missing something but I can't get JavaMail InternetAddress to accept email addresses that have full stops in the name part of the address.
    e.g. conrad.crampton@ britishlibrary.com
    conrad.crampton@ kent.pnn.police.uk
    (spaces in here deliberately)
    there are so many email addresses that have '.' in them so are they or not valid???? If not, how do I make them valid for the purposes of JavaMail - can they be surrounded by "" or the . escaped (\.)??
    Any suggestions as this is just bonkers!
    Ta
    Conrad

    You are correct in your assumption that this is happening when Transport.send(message) is called.
    I don't quite understand about the address not being in the mail server. The mail server I am using is one internal to my organisation (groupwise server), and I am trying to get a mail sent to an outside address in the format given before. The address is valid as far as a Groupwise client goes (and any other client I care to mention), so why is it rejected by the mail server? Does it have to be able to resolve this on some DNS somewhere?
    This all sound a little naive but it didn't occur to me to have to understand the minutae of messaging in order to use JavaMail.

  • Since loading Lion, I've experienced much more instability than Snow Leopard. In particular, Mail crashes with regularity, full-screen apps seem to run slower and show the beach ball more often for longer, etc.  I'm disappointed with the performance. Any

    Since loading Lion, I've experienced much more instability than Snow Leopard. In particular, Mail crashes with regularity, full-screen apps seem to run slower and show the beach ball more often for longer, etc. I love the features, but I'm disappointed with the performance. Any help coming from Apple?  I've been sending them so many reports after crashes, that their file must be full!

    Summoning max. courage, I did what you advised. Here is the result. What does this tell you? My Lion 7.2 (mid 2011 iMac) has several annoying glitches (which I have so far tolerated through gritted teeth) but none that have actually stopped me working.
    BTW, I see several items involving CleanMyMac which I did not know I had. It is generally villified as a trouble-maker. Spotlight can't find an app. or a utility of that name. How can I get rid of what's there please? Just delete?
    Last login: Thu Nov  3 20:55:11 on console
    Steve-Kirkbys-iMac:~ stevekirkby$ kextstat -kl | awk ' !/apple/ { print $6 $7 } '
    com.AmbrosiaSW.AudioSupport(4.0)
    Steve-Kirkbys-iMac:~ stevekirkby$ sudo launchctl list | sed 1d | awk ' !/0x|apple|com\.vix|edu\.|org\./ { print $3 } '
    Password:
    com.openssh.sshd
    com.stclairsoft.DefaultFolderXAgent
    com.microsoft.office.licensing.helper
    com.bombich.ccc.scheduledtask.067493DB-2728-4DF3-87D8-092EF69086E8
    com.bombich.ccc
    com.adobe.SwitchBoard
    Steve-Kirkbys-iMac:~ stevekirkby$ launchctl list | sed 1d | awk ' !/0x|apple|edu\.|org\./ { print $3 } '
    com.sony.PMBPortable.AutoRun
    uk.co.markallan.clamxav.freshclam
    com.veoh.webplayer.startup
    com.macpaw.CleanMyMac.volumeWatcher
    com.macpaw.CleanMyMac.trashSizeWatcher
    com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae
    com.adobe.AAM.Scheduler-1.0
    Steve-Kirkbys-iMac:~ stevekirkby$ ls -1A {,/}Library/{Ad,Compon,Ex,Fram,In,La,Mail/Bu,P*P,Priv,Qu,Scripti,Sta}* 2> /dev/null
    /Library/Components:
    /Library/Extensions:
    /Library/Frameworks:
    AEProfiling.framework
    AERegistration.framework
    ApplicationEnhancer.framework
    AudioMixEngine.framework
    FxPlug.framework
    NyxAudioAnalysis.framework
    PluginManager.framework
    ProFX.framework
    ProMetadataSupport.framework
    TSLicense.framework
    iLifeFaceRecognition.framework
    iLifeKit.framework
    iLifePageLayout.framework
    iLifeSQLAccess.framework
    iLifeSlideshow.framework
    /Library/Input Methods:
    /Library/Internet Plug-Ins:
    AdobePDFViewer.plugin
    EPPEX Plugin.plugin
    Flash Player.plugin
    Flip4Mac WMV Plugin.plugin
    JavaAppletPlugin.plugin
    Quartz Composer.webplugin
    QuickTime Plugin.plugin
    SharePointBrowserPlugin.plugin
    SharePointWebKitPlugin.webplugin
    Silverlight.plugin
    flashplayer.xpt
    iPhotoPhotocast.plugin
    nsIQTScriptablePlugin.xpt
    /Library/LaunchAgents:
    com.adobe.AAM.Updater-1.0.plist
    com.sony.PMBPortable.AutoRun.plist
    /Library/LaunchDaemons:
    com.adobe.SwitchBoard.plist
    com.apple.remotepairtool.plist
    com.bombich.ccc.plist
    com.bombich.ccc.scheduledtask.067493DB-2728-4DF3-87D8-092EF69086E8.plist
    com.microsoft.office.licensing.helper.plist
    com.stclairsoft.DefaultFolderXAgent.plist
    /Library/PreferencePanes:
    .DS_Store
    Application Enhancer.prefPane
    Default Folder X.prefPane
    DejaVu.prefPane
    Flash Player.prefPane
    Flip4Mac WMV.prefPane
    /Library/PrivilegedHelperTools:
    com.bombich.ccc
    com.microsoft.office.licensing.helper
    com.stclairsoft.DefaultFolderXAgent
    /Library/QuickLook:
    iWork.qlgenerator
    /Library/QuickTime:
    AppleIntermediateCodec.component
    AppleMPEG2Codec.component
    DesktopVideoOut.component
    DivX 6 Decoder.component
    FCP Uncompressed 422.component
    Flip4Mac WMV Advanced.component
    Flip4Mac WMV Export.component
    Flip4Mac WMV Import.component
    LiveType.component
    /Library/ScriptingAdditions:
    .DS_Store
    Adobe Unit Types.osax
    Default Folder X Addition.osax
    /Library/StartupItems:
    Library/Address Book Plug-Ins:
    Library/Frameworks:
    EWSMac.framework
    Library/Input Methods:
    .localized
    Library/Internet Plug-Ins:
    Library/LaunchAgents:
    com.adobe.AAM.Updater-1.0.plist
    com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae.plist
    com.macpaw.CleanMyMac.trashSizeWatcher.plist
    com.macpaw.CleanMyMac.volumeWatcher.plist
    com.veoh.webplayer.startup.plist
    uk.co.markallan.clamxav.freshclam.plist
    Library/PreferencePanes:
    .DS_Store
    Perian.prefPane
    WindowShade X.prefPane
    Library/QuickTime:
    AC3MovieImport.component
    Perian.component
    Library/ScriptingAdditions:
    Steve-Kirkbys-iMac:~ stevekirkby$

  • Synchroniz​ing two counter frequency inputs with multiple analog inputs

    Hello all,
    I'm fairly new to LabVIEW and I'm trying to collec​t data from multiple sources with synchronized tim​ing on the acquisition but I'm having trouble figu​ring it out. My problem is that I've got two count​er frequency inputs, one optical tachometer readin​g one pulse per revolution, and a max machinery fl​ow meter with a k factor of 12000. I can't seem to​ figure out how to sync the timing with my multiple analog inputs. I've be​en attempting to get the tachometer  to sync with ​the analog inputs first by following the example l​inked here. (https://decibel.ni.com/content/docs/DOC-10785) So far each time I run it I either get a timeout e​rror on the DAQmx read or a "Multiple sample clock​ pulses were detected" error (see attached image).  It seems if I slow the sampling rate way down to ​say 10 hz and ensure that the tachometer signal is​ over 800-1000 RPM (13-17 Hz) before starting the VI then the program will run without errors until ​the RPM drops below that threshold then the "Multi​ple sample clock pulses" error occurs.  The code is attached below.
    Does anyone know of a more effective way of syncin​g counter frequency inputs with analog inputs?  I'd like to have a VI that can show 0 RPM (and ev​entually 0 flow as well, but I think I need to fig​ure out the timing of one counter before I add ano​ther as it seems I can't have two counters in the ​same task). Any help on this would be greatly appr​eciated.
    LabVIEW version 13.0
    cDAQ-9178 Chassis with NI 9401 for the two counter inputs and NI 9205 for the analog inputs.
    Thanks!
    Richard
    Solved!
    Go to Solution.
    Attachments:
    SimpleDAQ.vi ‏44 KB
    LV_Error.JPG ‏31 KB

    Maybe third times the charm? 
    So I've finally got a good handle on why the VI is having problems at low RPM though I'm somewhat embarassed how long it took me to do that
    Because I have the counter time synced to my Analog input task if it doesn't see at least two pulses between the two clock pulses set by the analog input task I get the -201314 "Multiple sample clock pulses" error. This seems fine at first as it just sets a minimum RPM that I can measure and it's well below the area I'm interested in so no problems there.  I tried a simple error handler that would clear the error when it happend assuming the loop would keep iterating until the RPM went above that minimum at which point I would get a signal again. This is not the case, the read function just continues to spit out the -201314 error even after the RPM is back in the readable range. So then I tried adding two case structures so that when the error occured it would stop the task, clear the error, and then start the task again on the next loop iteration (Code Attached). This also doesn't work as the error shows up again on the stop task and then AGAIN on the start task on the next loop iteration. It seems this error is not actually being cleared and once it happens it stays with the task regardless of what the error cluster is carrying. 
    Anyone have any ideas?  The only solution I can think of is to just clear all tasks and recreate them each loop iteration until the RPM is readable again but that strikes me as a horribly clunky solution.
    Richard 
    Attachments:
    SimpleDAQ_1_Start Stop.vi ‏48 KB

  • Error while executing SSIS package - Error: 4014, Severity:20, State: 11. A fatal error occurred while reading the input stream from the network. The session will be terminated (input error: 109, output error: 0)

    Hi,
    We are getting the following error when running our SSIS packages on Microsoft SQL Server 2012 R2 on Windows Server 2008 R2 SP1:
    Error: 4014, Severity:20, State: 11.   A fatal error occurred while reading the input stream from the network. The session will be terminated (input error: 109, output error: 0)
    SQL Server Data Tools and SQL Server Database Engine reside on the same server.
    We tried the following:
    Disabling TCP Chimney Offload
    Installed Windows Server 2008 SP1
    Splitting our SSIS code into multiple steps so it is not all one large continuous operation
    The error occurs during a BulkDataLoad task.
    Other options we are investigating with the engineering team (out-sourced, so delayed responses):
    Firewall configurations (everything is local, so this should not make a difference)
    Disabling the anti-virus scanner
    Are there other things we can try?
    Any insight is greatly appreciated.
    Thanks!

    Hi HenryKwan,
    Based on the current information, the issue can be caused by many reasons. Please refer to the following tips:
    Install the latest hotfix based on your SQL Server version. Ps: there is no SQL Server 2012 R2 version.
    Change the MaxConcurrentExecutables property from -1 to another one based on the MAXDOP. For example, 8.
    Set "RetainSameConnection" Property to FALSE on the all the connection managers.
    Reference:
    https://connect.microsoft.com/SQLServer/feedback/details/774370/ssis-packages-abort-with-unexpected-termination-message
    If the issue is still existed, as Jakub suggested, please provide us more information about this issue.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Spacing after full stop

    Hi
    My printer is complaining that my justified text makes it look like there is no space after a full stop. In some cases, it does appear this way.
    Is there any way to set a minimum or uniform amount of space after each full stop, within justified text? I have searching this forum + google but did not find an answer.
    Many thanks..

    Thanks for the reply Jacob,
    The font is Myriad Pro, and the the app is InDesign cs3.
    Actually before reading your reply I decided to you what you suggested, I went through and just added a space where there appeared to be none. This took a few minutes but the result looks fine.
    I hadn't considered that it might be a problem with the font - I was surprised that InDesign wouldn't have a control in place to make sure there was proper spacing after a full stop, in justified text, but it makes sense that it could be an anomaly with the Myriad Pro font.
    Cheers

  • HT5449 How do I get Dictation to type a full-stop instead of the word "period"?

    How do I get Dictation to type punctuation? The support article says that you just have to speak it in order for it to appear but I just get one long run-on sentence with the word "period" many times in the middle.

    Try the alternatives: "point," "dot," and/or "full stop." Do any of these options produce a period for you? And, as a different punctuation test, does something such as "comma" work for you?

  • Capitalize the first letter after full stop.

    Since I m not a Java Programmer, my speciality is PERL. I m looking
    for a little support from any of the Javascripts Gurus here. Its
    going to take 5 or less minutes for you to solve this issue.
    I have a textbox and I want when users are typing in it. The word
    after full stop (.) will be capitalized just like MS-Word. I mean
    the begining of the new sentence with capital letter, users don't
    have to push "shift" button to capitalize the first letter after
    every full stop .
    thanks for your help.
    Any Ideas,
    Zeshan.

    Try Google. Have you heard of it? www.google.com
    do a search!

  • Arabic full stop appears in front

    Hi I use CS InDesign 6. With world ready paragrapher composer, I can copy and paste Arabic text in CS6. But the full stop always appears in front of the last line. Not at the end. Any idea how to fix it?
    It's a pain to use a separate text box and put full stop in the right place manually.

    There are a variety of ways to make this work for you. I am assuming that you are using English-language ID and don't even know that there is an entirely separate Middle East Edition that gives you complete typographical control over right-to-left languages. The World-Ready Composer lets the letters of individual words compose correctly, but you need to turn on right-to-left paragraph direction - and there are no controls for same in non-ME editions of InDesign.
    So, unless you decide to go out and buy a whole separate license for the ME edition, your options are:
    1) Buy a plugin that exposes the RTL type controls. I always recommend World Tools from in-tools.com, because it exposes stuff in the ME edition as well as the CJK edition (Chinese, Japanese, Korean) in generic English InDesign. This is the best price-performance ratio, I think, for money spent to typographical control gained.
    2) Use a script or a template that already has those settings for right-to-left paragraph flow activated. If you search Google for "world-ready paragraph composer" you can find a few of those. I don't have a link on hand. They're out there, and they're free, but if you need to do something fancy (hanging indents, kashidas, LTR Arabic numerals for phone numbers and Hindi numerals for everything else, lots of bilingual sentences with frequent direction flow changes, and so on) you probably need either the ME edition or a plugin. You can do it with freely available character styles (or you can write 'em yourself if you know some Javascript) but I have found that to be a time-consuming way to work.
    3) But if all you need is one paragraph of legible Arabic... then you can start a new text frame, go to the Type menu, and hold down control and choose "Fill with Placeholder Text" and, instead of getting lorem ipsum, you'll get a dropdown menu that will let you pick fake text in a variety of scripts. If you pick Arabic, you'll get correctly flowing Arabic text with the right paragraph direction applied.

Maybe you are looking for

  • 10.5.6 auto update not working and how I fixed it

    I ran into an issue installing 10.5.6 like many others apparently have. I'd run the auto update and it would stall at Configuring Installation with the progress bar moving maybe 1/8th of the way. I'd restart and try again with no success. I tried ver

  • How to set Calendar size in forms 6i

    Hello all, I'm using forms6i. I want to create a calendar control which should display when a button is pressed. i tried using standard.olb and calendar.pll files. But the size of the calendar is too small in the output.

  • Cannot remove stateful session bean when transaction timed out

    The transaction timeout is set to 5 minutes. After several operations on the transactional stateful session bean(implements SessionSynchronization), the transaction timed out after 5 minutes and I got the IllegalStateException when calling another bu

  • Coldfusion server monitor in Japanese: how change language?

    Hi, I have a coldfusion 10 developer edition installed. In my admin panel I have english language. But my server monitor is in Japanese. I don't know why. How can I change the language of the monitor?

  • Problems with Safari (4.0.5) Mail and Time Machine

    For some time I have been experiencing every day issues with Safari and Mail. These apps constantly crash i.e. several times a day. Recently I noticed also some issues with Time Machine. Please find below extract form Console that may say smething ab