I am writing a method that can do some filtering and manipulations on a String intended for chat client.
The method main purpose is to recognize commands and returns the appropriate output and do some string replacements.
Here what I have come up with so far:
This seems to work a bit but it has limitations and performance hit in String replace methods.
I want to do it using better and efficient approach, I have looked at Pattern and Matcher replacement methods but don't seems to figure it out with this context.
Further I would like to pass for example: "/me grins" and get "Ahmed grins"
Any ideas would be appreciated. Thanks in advance.
Bill Shirley
Ranch Hand
Joined: Nov 08, 2007
Posts: 457
posted
0
Originally posted by Ahmed Yehia: I want to do it using better and efficient approach, I have looked at Pattern and Matcher replacement methods but don't seems to figure it out with this context.
Further I would like to pass for example: "/me grins" and get "Ahmed grins"
You're on the right track. Read the docs over again and give it a try - you should be able to reimplement what you have with them. Once you have that it should scale better.