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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:26:11+00:00 2026-06-14T20:26:11+00:00

In Java there is a method splitByCharacterType that takes a string, for example 0015j8*(

  • 0

In Java there is a method splitByCharacterType that takes a string, for example 0015j8*(, and split it into "0015","j","8","*","(". Is there a built in function like this in c#? If not how would I go around building a function to do this?

  • 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-14T20:26:12+00:00Added an answer on June 14, 2026 at 8:26 pm
    public static IEnumerable<string> SplitByCharacterType(string input)
    {
        if (String.IsNullOrEmpty(input))
            throw new ArgumentNullException(nameof(input));
    
        StringBuilder segment = new StringBuilder();
        segment.Append(input[0]);
        var current = Char.GetUnicodeCategory(input[0]);
    
        for (int i = 1; i < input.Length; i++)
        {
            var next = Char.GetUnicodeCategory(input[i]);
            if (next == current)
            {
                segment.Append(input[i]);
            }
            else
            {
                yield return segment.ToString();
                segment.Clear();
                segment.Append(input[i]);
                current = next;
            }
        }
        yield return segment.ToString();
    }
    

    Usage as follows:

    string[] split = SplitByCharacterType("0015j8*(").ToArray();
    

    And the result is "0015","j","8","*","("

    I recommend you implement as an extension method.

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

Sidebar

Related Questions

is there any example on using java method to call rhino-javascript function and return
Is there any method so that I can split a text file in java
Is there a method/function in Java that checks if another method/function is available just
how do I make my swap function in java if there is no method
Is there any technique available in Java for intercepting messages (method calls) like the
Is there a method in Java to automatically ellipsize a string? Just in Java,
Is there any method has the functionality of an IF-THEN-ELSE statement in java like
Is there some method to convert a Vector<String> to a Vector<Integer> in Java ?
In Java's standard library, is there a method that would allow one to sort
Is there java utility that does clone() method for HashMap such that it does

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.