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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:06:41+00:00 2026-06-08T21:06:41+00:00

I need help grabbing some string operation in Javascript. I have a sample string

  • 0

I need help grabbing some string operation in Javascript. I have a sample string as

var str = 'Supplier^supp^left^string*Spend (USD MM)^spend^right^number^5';

The string is basically a configuration for a portlet for two columns as Supplier and Spend..I have to get the column names from this string. Each star follows a new column config. In this case there are configs for only 2 columns and hence only 1 star exists in my string. Supposedly if there are 2 columns the string will look like

var str = 'Supplier (Name)^Supplier^left^string*Spend (USD MM)^Spend^right^number^5*Location (Area)^Loc^right^string^*Category ^Categ^right^string';

So from the above string i had written a logic to get the desired string as
after the 2nd caret i want ‘Supplier'(1stcolumn data name and not ‘Supplier (Name) which is a display name) ,(Moving to 2nd column after the star)after the 2nd caret ‘Spend’.Similarly ‘Loc’ (3rd column) and ‘Categ’ (4th column). Can anybody help me achieve this? Here is what i had written

    function getColNamesfromConfig(str) {
        var i = str.indexOf('^');
        var tmpCatStr = str.slice(i + 1);
        var catField = tmpCatStr.slice(0, tmpCatStr.indexOf('^'));

        var j = tmpCatStr.indexOf('*');
        var tmpStr = tmpCatStr.slice((j + 1));
        var k = tmpStr.slice(tmpStr.indexOf('^') + 1);
        var valField = k.slice(0, k.indexOf('^'));
        return { categoryField: catField, valueField: valField };
    }
  • 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-08T21:06:42+00:00Added an answer on June 8, 2026 at 9:06 pm

    You can use split()

    str.split('*')[0].split('^')[1]
    

    the above code will give you

    Supplier
    

    Check the following link

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

Sidebar

Related Questions

I need help grabbing the maximum value from a dictionary. I have a dictionary
Ok this is really making me crazy and I need some help. I have
Please I need your help with grabbing rows from a table and dynamic text
Need help with a query that I wrote: I have three tables Company id
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
need help/guide for sql select query, I have 2 table stock and stock_history, in
need help regarding USSD Gateway. I have to develop an app, which will directly
need help in error in database pivot. i have table tamed table_score like below:
I need help with an <input> . Some times when I call for the
Need help. I have Graph API code that uses an auth token with offline

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.