Two Laptop Bag*
The moose likes Beginning Java and the fly likes Ignoring of blanks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Ignoring of blanks" Watch "Ignoring of blanks" New topic
Author

Ignoring of blanks

petr pavlovich
Greenhorn

Joined: Jul 10, 2011
Posts: 22
Hi!
How to make so that in lines coming and after standing blanks were ignored?
that is
" aaa " = "aaa" ="aaa ''
Name entrance and a way to target files should be set in the form of two parameters of a command line.
in my program
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Hi Petr,
I dont understand the program completely. But still is the question is about trimming beginning and trailing white space in string - then use trim() function in String class.
petr pavlovich
Greenhorn

Joined: Jul 10, 2011
Posts: 22
Hi John Jai!
my program: sorting (alphabetically) and outputs the string without repetitions.
petr pavlovich
Greenhorn

Joined: Jul 10, 2011
Posts: 22
if the array change"aaa" on " aaa ", the program will not work correctly.


John Jai wrote:Hi Petr,
use trim() function in String class.
how to apply, I do not understand (
Ashish Schottky
Ranch Hand

Joined: Dec 29, 2009
Posts: 93
@petra: Welcome to Javaranch.
This seems to be a home-work problem.And you have done well.
just use a for-loop and use trim for every string.


petr pavlovich
Greenhorn

Joined: Jul 10, 2011
Posts: 22
Ashish Schottky wrote:@petra: Welcome to Javaranch.
thanks
Ashish Schottky wrote:
This seems to be a home-work problem.And you have done well.
just use a for-loop and use trim for every string.



Excuse but don't know as to apply your code
The compiler gives out errors
=)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38481
    
  23
. . . and what errors do you get? I can see at least one error. There is a { missing. There might be more; I haven't checked carefully.

You should be writing your code from outside in, not from top to bottom. I would appear to have written that sort of thing before. Look at the links from it, particularly the second.
petr pavlovich
Greenhorn

Joined: Jul 10, 2011
Posts: 22
Campbell Ritchie wrote: particularly the second.

thanks!!
I will well write
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ignoring of blanks