• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

generating string

 
Puneet N Vyas
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abcabdabeabfacdaceacfadeadfaefbcdbcebcfbdebdfbefcdecdfcefdef

consider the above set of strings generated, now i am iterating over the collection containing these strings, now i need to modify each of the string,for example: string abc should be changed to:
a([^ b]*)b([^ c]*)c
similarly other string has to be modified like above,can any one how to do this.

thanks for support
 
Henry Wong
author
Marshal
Pie
Posts: 21022
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks pretty straightforward. What have you tried so far?

Henry
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

That should also handle longer strings. Only if the string is empty this code will throw an ArrayIndexOutOfBoundsException.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic