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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:59:29+00:00 2026-05-25T15:59:29+00:00

I have a problem with string.split using.NET 3.5: String to split is: dim source

  • 0

I have a problem with string.split using.NET 3.5:

String to split is:

dim source as string = "ab|foo|bar|bar|bar-foo|ab|ezrezertr|ghghhjhj|ab|foo|xxx|"
dim result() as string = source.split("ab|")

When used within a Winforms applicaton, the result is “correct”:

result(0) is “foo|bar|bar|bar-foo|”

result(1) is “ezrezertr|ghghhjhj|”

result(2) is “foo|xxx|”

And I’m happy!

When used within an ASP.NET code behind, the result is:

result(0) is “b|foo|bar|bar|bar-foo|”

result(1) is “b|ezrezertr|ghghhjhj|”

result(2) is “b|foo|xxx|”

In other words, the split function only get rid of the 1st character of the separator string!
Does someone know why?

  • 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-05-25T15:59:29+00:00Added an answer on May 25, 2026 at 3:59 pm

    The ASP.NET results look like you are using Regex.Split rather than String.Split. The string "ab|" will be interpreted as a regular expression for “a” followed by “b” or nothing, so just an “a” matches.


    Later: Second Theory:

    • There is no overload of String.Split that takes a single string argument. The only single argument overload takes an array of char.
    • String.Splt(char()) will split on any of the passed characters.
    • VB, without Option Strict On will implicitly convert a string to an array of chars.

    Hence I think in the ASP.NET case you don’t have option strict on, therefore theString.Split(anotherString) is being treated as theString.Split(anotherString.ToCharArray()).

    Thus splitting on just a "b".

    However this leaves the question of how the first cases acts as passing a string, but there is no overload taking a String() without extra parameters (a SplitOptions)…

    Summary: Visual Basic’s extra implicit conversions and behaviour set at a file/project/language level can make identical code behave differently.

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

Sidebar

Related Questions

I having a problem on using Split Method() . I have a string like
I am using LaTeX and I have a problem concerning string manipulation. I want
I have a problem converting a string binary to a decimal I was using
Hi I have a problem with a javascript string var foo = \<a href=javascript(foo('a','b'))>test</a>\
I have a problem where I need to tokenize my string (using java code)
I have a problem with a string in C++ which has several words in
I have a problem that output string must be utf8-formatted, I am writing currently
I have a problem while converting a string whose value is dd.mm.yyyy to DateTime
I have a performance problem related to string comparison (in Java). I'm working on
I have following problem, Code: String a=Yeahh, I have no a idea what's happening

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.