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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:59:42+00:00 2026-05-27T02:59:42+00:00

var string = abc123; string.split(*POSITION=3)??? Is there a way to split this string into

  • 0
var string = abc123;
string.split(*POSITION=3)???

Is there a way to split this string into an array of strings that is [abc,123]?
Is the split method the right thing to use?

  • 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-27T02:59:42+00:00Added an answer on May 27, 2026 at 2:59 am

    I would say the split method is not the right thing to use here, as its purpose is to segment a string based on a certain character.

    You could certainly write your own function, of course:

    function partition(str, index) {
      return [str.substring(0, index), str.substring(index)];
    }
    
    // results in ["123", "abc"]
    var parts = partition("123abc", 3);
    

    If you wanted to write "123abc".partition(3) instead, you could make that possible by extending String.prototype:

    String.prototype.partition = function(index) {
      return [this.substring(0, index), this.substring(index)];
    };
    

    Personally, though, I’d recommend avoiding that sort of tomfoolery (search the web for “extending built-in objects in JavaScript” if you want to read what others have to say on the topic).

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

Sidebar

Related Questions

I was wondering if there is a way having this var string = foo::bar
I know there is a more readable way of writing this: var string =
Is this code safe in all major browsers? var string = '123' alert(string[1] ==
I have this... $('#orderFormDiv_Lines').append(TheOrderLine); That .appends 'TheOrderLine' var string at the end of a
I'm trying to split a string into an array based on the second occurrence
I want a string split at every single character and put into an array.
Let's say I have this string var: string strData = 1|2|3|4||a|b|c|d Then, I make
I have an array: var locations = ['Afghanistan','Albania','Algeria','New York']; and a string: var string
So I have something like this: var xmlStatement:String = xmlObject.node[3].@thisValue; What mystery function do
I'm trying to do a replace on a string like this: $('#example_id').replace(/abc123/g,'something else') But

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.