null char elimination

the program i'm working with will display two file names, null is in the name, how do i get that out?
nullfilename1
nullfilename2

I think it with this line of code that things are getting messed up
if(sorter1[i].charAt(i) != ' ') {

Since ' ' does not = null and you can't have null == char, i'm not sure what will work

Suggestions?
no158Asked:
Who is Participating?
 
CEHJCommented:
s = s.replaceAll("\0", "");

works well enough
0
 
CEHJCommented:
Try

s = s.replace("\x0", "");
0
 
CEHJCommented:
Should be replaceAll
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
no158Author Commented:
I'm working with a String array
sorter1[i] = sorter[i].replaceAll("\0", "");

is giving me output that looks like:
nullfilename1
nullfilename2
0
 
CEHJCommented:
>>is giving me output that looks like:

Not sure what your point is ...
It will eliminate null chars
0
 
no158Author Commented:
Off set the string by 4 char's and it fixed this problem, for some reason the replaceAll code was not doing its job deep within loops. Ill have to fine comb this later but for now I need to have a working product.
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.