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

  • Home
  • SEARCH
  • 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 8367291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:07:14+00:00 2026-06-09T13:07:14+00:00

I tried to split a string wich contains these character # domicilioSeparado = domicilio.Split(@#.ToCharArray());

  • 0

I tried to split a string wich contains these character #

domicilioSeparado = domicilio.Split(@"#".ToCharArray());

but every time the array contains just one member. I’ve tried a lot of combinations but anything seems to work, I also tried to replace the string with a blank space and it kinda works – the problem is that it remains a single string.

domicilio = domicilio.Replace(@"#", @" ");

How can I resolve this?

Complete code:

String[] domicilioSeparado;
String domicilio = dbRow["DOMICILIO"].ToString();

domicilioSeparado = domicilio.Split(@"#".ToCharArray());
if (Regex.IsMatch(domicilioSeparado.Last(), @"\d"))
{
    String domicilioSinNum = "";
    domicilioSinNum = domicilioSeparado[0];
    custTable.Rows.Add(counter, dbRow["CUENTA"], nombre,
        paterno, materno, domicilioSinNum, domicilioSeparado.Last(), tipoEntidad);
} 
  • 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-09T13:07:16+00:00Added an answer on June 9, 2026 at 1:07 pm

    Try this:

    string[] domicilioSeparado;
    domicilioSeparado = domicilio.Split('#');
    

    Some notes:
    1 – It is (‘#’), instead of (“#”); 2 – Replace does not split a string, it only replace that part, keeping as a single string.

    In case you want an example that includes the printing of the whole array:

    string domicilio = "abc#def#ghi";
    string[] domicilioSeparado;
    domicilioSeparado = domicilio.Split('#');
    for (int i = 0; i < domicilioSeparado.Length; i++)
    {
       MessageBox.Show(domicilioSeparado[i]);
    }
    

    It will open a Message Box for each element within domicilioSeparado.

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

Sidebar

Related Questions

I have an array called selectMe formed by a variable wich contains a string
I tried to split a string in a linq query. I got an error
I tried to split two fields from a binary string: -define(S,<<M\0\0\0522039355099,010100000008,0,010170000000,0,0,0,0,0,0,,,0,0,,‌​0110,00,150,0,0,0\0>>).<<Message_length:4/binary,Msg/binary>> = S. the
I am trying to split/explode/preg_split a string but I want to keep the delimiter
I don't know why I have to use Array.toString in the split(String reges) method.
I want to split a string into an array. The string is as follows:
I have to split a string in a bash script by / but I
I want to split a string into parts based on a regex (\$\d+\$), but
How can I split a string using a string delimeter? I've tried: string[] htmlItems
i tried to split a string looks like this <a><b><c></c></b></a> with java using the

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.