This week's book giveaway is in the Spring forum.
We're giving away four copies of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 and have Marten Deinum & Iuliana Cosmina on-line!
See this thread for details.
Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

String Interpretation.

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am just starting a pet project for which i need some guidance and help. I have been programmer in the past but not done much programming lately, so i do need to brush up on some stuff.

The question I have is if someone can direct me to some reading materials, tutorials, existing APIs, etc. for the following problem.

One of the core functionality of my project involves parsing/interpreting a long string of 'words'. The 'word' is a combination of characters, numbers and symbols. Here is an example Ci|5/4, There are 4 parts to this word C, i, | and 5/4. It is also possible that some of the parts can get omitted, for example Cq|, which means Cq|3/2, or simply
C which means Cq etc. The first part can be 2 characters long for example, Cxq|5/4. So the breakdown here is Cx, q, |, 5/4. I can write these words out and I am comfortable with what they mean when I read it, but now I need to be able to make my program understand them. That is interpret the word and extract the different parts of the word so that I can do the necessary mapping.

I am assuming there might be some libraries, or procedures our there that will help me with this. Can you please guide me in the correct direction.

Thanks
 
author
Posts: 23899
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am assuming there might be some libraries, or procedures our there that will help me with this. Can you please guide me in the correct direction.



What you are describing is pretty straightforward -- and could probably done using the methods of the java.lang.String class. Or you can try regex -- see the java.util.regex.Pattern class.

Henry
 
Marshal
Posts: 72950
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To add to what Henry says, this Java ™ Tutorials link about regular expressions may also be helpful.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic