Results 1 to 2 of 2
Thread: Rotate Text Inside Brackets
- 10-16-2010, 12:09 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 16
- Rep Power
- 0
Rotate Text Inside Brackets
Hey everyone,
Im pretty new to Java so hopefully some of you will be able to help me out!
I'm working on an application where users input text. How exactly would I tell my program to perform a task but only between brackets {} that a user enters.
For example...
A user writes a body paragraph, but during the body paragraph they can {designate particular sentences with brackets}. I want to know how to tell the computer to perform a task but only inside the brackets.
Would appreciate any feedback. Thanks.Last edited by corbokhan; 10-16-2010 at 12:19 AM.
- 10-16-2010, 01:01 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
Basically you are trying to parse the text that the user enters. That is trying to find prtions of the text with special meaning to your application.
A lot of the detail depends on the exact rules for making the designations. For example can designated text itself contain curly braces? If so how are these braces different from braces that delimit the text being designated? Does { always follow whitespace (and } always preceed white space or punctuation) as in your example? Ie do the braces always occur around words?
For the "simple" case where designated text cannot contain the brace symbols and where the various bits of text can occur anywhere then there are string methods that can help. Look at indexOf(ch,from) which finds the index offset of ch. Because you can specify where to start looking it is well suited to use within a loop. substring(begin,end) will be useful once you have found the positions of the brace symbols.
Similar Threads
-
Using regex to retrieve all text inside parentheses
By adhoc334 in forum Advanced JavaReplies: 5Last Post: 08-18-2010, 08:05 PM -
use of <> brackets
By dqlevitt in forum New To JavaReplies: 3Last Post: 05-27-2010, 09:34 PM -
I can't read a text file located inside my jar.
By Serrano0811 in forum New To JavaReplies: 1Last Post: 04-21-2010, 05:03 PM -
problem in displaying text inside the item label - JFREECHART
By chittora in forum Java 2DReplies: 9Last Post: 07-21-2009, 02:41 AM -
problem aligning both image/text inside a button
By rick_cols in forum SWT / JFaceReplies: 0Last Post: 09-18-2008, 08:20 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks