@Raza: Please don't provide complete solutions. Our goal on JavaRanch is to help people learn how to learn, figure out problems, and so on--rather than just do somebody's work for them, encourage them to spend some quality time on it themselves, try various solutions, etc. Thanks.
For the directories given by you ... according my algorithm it will be
c:\checko~1\foo
c:\checko~1\foo
No, This must be like
c:\checko~1\foo
c:\checko~2\foo
java.lang.String API having this solution. Algo should be look like this
loop1 while mainStr not null
resArr[count++] = mainStr.slice(indexof("\\"))
end Loop2
loop2 while resArr
1. you can use selection/binary sorting here
2. truncate tailing chars with ~1
3. do compare array element for 8 char similar string.
4. if similar truncate tailing chars with ~2,3,4... so on
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
4
posted
0
Apology accepted, on behalf of JavaRanch
Preetish Panda
Greenhorn
Joined: May 10, 2010
Posts: 9
posted
0
Ritesh Pareek wrote:
For the directories given by you ... according my algorithm it will be
c:\checko~1\foo
c:\checko~1\foo
No, This must be like
c:\checko~1\foo
c:\checko~2\foo
java.lang.String API having this solution. Algo should be look like this
loop1 while mainStr not null
resArr[count++] = mainStr.slice(indexof("\\"))
end Loop2
loop2 while resArr
1. you can use selection/binary sorting here
2. truncate tailing chars with ~1
3. do compare array element for 8 char similar string.
4. if similar truncate tailing chars with ~2,3,4... so on
You are not getting me .In my case there will be only one string and only ~1 has to be appended.
No question of ~2,~3,...