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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:42:55+00:00 2026-06-05T21:42:55+00:00

I have a string using the pipe symbol | as the delimiter. However, the

  • 0

I have a string using the pipe symbol “| as the delimiter. However, the string data also contains the pipe symbol. Is there a way to ignore this?

Example:

name|address|age

John|123 Wood Road|Street, London|25

Therefore when I do this –

text.split("\\|")

gives me:

John

123 Wood Road

Street, London

25

I am expecting this:

John

123 Wood Road|Street, London

25
  • 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-05T21:42:57+00:00Added an answer on June 5, 2026 at 9:42 pm

    String.split() can’t differentiate between different occurrences of the same symbol. You’ll have to put in place some rules, either in code or in a regex. Based on your data, I’m guessing that while you say that pipe can occur within the string data, it really can’t occur in name or age, so you could do something like this:

    String[] results = text.split("\\|")
    
    String name = results[0];
    String age = results[results.length - 1]
    
    String address = results[1];
    for (int i = 2; i < results.length-1; i++) {
        address = address + "|" + results[i];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string containing XML document using LinqtoXML What is the best way
I am using VS2005 c#. I have this function for converting pipe delimited text
If I have a string of pipe-delimited data: 123456|abcd|||65464|hgfhgf How can I replace any
I am using AIX and I have a string There is no process to
I have made a String[] array by using String.split(.) . I am now trying
I have string like \LESSING\root\cimv2:Win32_UserAccount.Domain=LESSING,Name=Admin How to convert it to LESSING\Admin using Framework?
I have read that to match a word inside of a string using Regular
I have a big string having at most 100000 character. Instead of using string.charAt[index]
How can I convert TO a Nullable from a String using reflection? I have
Using String.Format how can i ensure all numbers have commas after every 3 digits

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.