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 9134817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:43:46+00:00 2026-06-17T08:43:46+00:00

I have this line: (ADDRESS = (PROTOCOL = XXX)(HOST = YYY)(PORT = ZZZ)) that

  • 0

I have this line:

(ADDRESS = (PROTOCOL = XXX)(HOST = YYY)(PORT = ZZZ))

that I need to retrieve the HOST name which is in this case YYY.

I don’t know if it will be written in lowercase or uppercase or even a mix between them.
So I switch the whole line to uppercase by line.toUpperCase() and then I split the line according to HOST = and I pick the characters until I get ) which indicates the end of the host name.

I’m sure there is a better way to do this. Any hints will be appreciated.

My code:

String host = "";
line = line.toUpperCase();
int i = line.indexOf("HOST");
while(line.charAt(i)!='=')
    i++;
while(line.charAt(i)!=')') {
    i++;
    if(line.charAt(i)!=')'&&line.charAt(i)!=' ')
       host = host + line.charAt(i);
}
return host;
  • 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-17T08:43:47+00:00Added an answer on June 17, 2026 at 8:43 am

    Try

        String s= "(ADDRESS = (PROTOCOL = XXX)(HOST = YYY)(PORT = ZZZ)) }";
        String host = s.replaceAll("^.+\\((HOST|host) *= *(.+?)\\).+$", "$2");      
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this line: $(#clients-edit-wrapper).height($(window).height()-150); I would like to apply that height function to
I have this line below that shows a link to go the next page
I have a SQL*Loader control file that has a line something like this: FIELDS
I currently have this line in my muttrc file to add any address to
I have this line of javascript which creates a listing of store locations, and
I have an html Address line like this: Addressline1<br>Addressline2<br>... How can I split them
I have this line of code Account.build_address and this works but I need to
I'm accessing the address book and have this line and am compiling using ARC:
I have this line in my code: myGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE); It works perfectly fine in ICS,
I have this line: <?php the_date(' F j Y')?> this ends up with June

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.