Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:25:19+00:00 2026-06-15T05:25:19+00:00

I have some Strings in java, which come from an ontology file and they

  • 0

I have some Strings in java, which come from an ontology file and they have the format:
<owl:onProperty rdf:resource="http://www.co-ode.org/ontologies/pizza/pizza.owl#WHAT_WE_WANT"/>

I need to make a function that finds if a specific String value is included in WHAT_WE_WANT and then returns the String WHAT_WE_WANT.

So, I splitted every line of the ArrayList at “#”, then I searched for the String value into the second part of the splitted lines. Now all I have to do is to get rid of “/>.
I was trying to split in ” symbol, but I cannot do it, because when I write “”” the compiler does not recognize that ” is the String symbol I need. Any ideas?

In case my word-explanation was not very good, here is my code:

   if (nextLine.matches(".*" + lookUp + ".*"  ))
    {String lala[]=nextLine.split("#");
    for(int i=0;i<lala.length;i++){
        if(lala[i].matches(".*"+lookUp+".*")){
            String[] temp=lala[i].split( """ ); //<--- doesn't work :/
            System.out.println(temp[0]);
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:25:20+00:00Added an answer on June 15, 2026 at 5:25 am

    This will give a compilation error:

    String[] temp=lala[i].split( """ );
    

    because the string literal is malformed. If you want to split where there is a double-quote character you need to escape the double-quote.

    String[] temp=lala[i].split( "\"" );
    

    In a string literal, an unescaped double quote means “this is the end of the string”. So the compiler will think that you have written an empty String ("") followed by an unterminated String literal (" );. When it reaches the end of the line, the compiler complains that the string is not terminated … because a Java String literal cannot span multiple lines.


    The stuff that you are trying to decode is OWL … which means you could (and maybe should) parse it using an OWL parser, and RDF parser or an XML parser … rather than bashing it with regexes, etcetera.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some Java code which looks roughly like this: String urlString = ftp://polar.ncep.noaa.gov/pub/history/waves/multi_1.glo_30m.dp.200601.grb2;
In my application,i have some .strings files.And on a button click,which is on my
I have some code which takes strings representing hexadecimal numbers - hex colors, actually
I have a text file that contains some strings separated by ,. Strings are
I have the following code which does nothing but reading some values from a
I have a list of strings in Java which are being written to a
We have a Java project which contains a large number of English-language strings for
I'm designing a Java application using SWT. I have some tables which will display
Strings in Java support structural sharing for some methods like substring , which means
Possible Duplicate: How do I compare strings in Java? i have written some code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.