Results 1 to 2 of 2
  1. #1
    corbokhan is offline Member
    Join Date
    Oct 2010
    Posts
    16
    Rep Power
    0

    Default 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 01:19 AM.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    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

  1. Using regex to retrieve all text inside parentheses
    By adhoc334 in forum Advanced Java
    Replies: 5
    Last Post: 08-18-2010, 09:05 PM
  2. use of <> brackets
    By dqlevitt in forum New To Java
    Replies: 3
    Last Post: 05-27-2010, 10:34 PM
  3. I can't read a text file located inside my jar.
    By Serrano0811 in forum New To Java
    Replies: 1
    Last Post: 04-21-2010, 06:03 PM
  4. Replies: 9
    Last Post: 07-21-2009, 03:41 AM
  5. problem aligning both image/text inside a button
    By rick_cols in forum SWT / JFace
    Replies: 0
    Last Post: 09-18-2008, 09:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •