Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7684625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:04:16+00:00 2026-05-31T19:04:16+00:00

The Scanner class provides a convenient method to skip over whitespace and get complete

  • 0

The Scanner class provides a convenient method to skip over whitespace and get complete string tokens. However, I am encountering the following situation-

I have input as follows-

   Public Type XYZ
       A(3) As Byte
       B(0) As Byte
       C(0) As Byte
   End Type

I am using a Scanner to scan through input like this. The scanner correctly returns tokens like “Public”, “Type”, “XYZ”, etc. However, is there a way to find out what was skipped? For instance, after XYZ, the scanner actually skips a “\n” instead of a blankspace – ” “. How to find out what the scanner skipped over?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:04:17+00:00Added an answer on May 31, 2026 at 7:04 pm

    This isn’t possible as the Scanner class returns the tokens without the trailing delimiter. In this case, without the trailing whitespace character. I don’t believe there is a way to get it back.

    One solution would be to parse the file line by line using the BufferedReader and FileReader classes. That way you have full access to the characters individually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Java's useDelimiter method on it's Scanner class to do
package GC; import java.util.Scanner; public class main { public static void main(String args[]) {
import java.io.*; import java.util.Scanner; import java.util.StringTokenizer; public class Filereader { public static void main(String[]
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class InversionCounter { public static void main(String[]
I am using scanner class in java5, and the following code will throw an
Few questions on over riding. I am interiting a method openRead from another class,
I've written a helper class that takes a string in the constructor and provides
I am using Scala combinatorial parser by extending scala.util.parsing.combinator.syntactical.StandardTokenParser . This class provides following
I'm using the Scanner class in java to go through a a text file
In a Android application I want to use Scanner class to read a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.