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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:39:43+00:00 2026-06-14T14:39:43+00:00

I have a title like Virtual Team Resources then i need its short code

  • 0

I have a title like Virtual Team Resources then i need its short code like VTR
If Title Virtual Team then ShortCOde will be VTE
i have implement this but still some issues like
if user enter title Virtual T then short code will ?

My Code——

function EnterShortCode() {
           debugger
           var ProjectShortCode = "";
           var Arr = $("#txtProjectTitle").val().rtrim().split(" ");
           for (i = 0; i < Arr.length; i++) {
               if (Arr[i] != "" && Arr[i] != null) {
                   ProjectShortCode += Arr[i].substring(0, 1);
                   if (i == Arr.length - 1) {
                       if (ProjectShortCode.length == 1) {
                           if (Arr[i] < 3) {

                           }
                           else {
                               ProjectShortCode = ProjectShortCode + Arr[i].substring(1, 3);
                           }
                       }
                       else if (ProjectShortCode.length == 2) {
                           if (Arr[i] < 2) {

                           }
                           else {
                               ProjectShortCode = ProjectShortCode + Arr[i].substring(1, 2)
                           }

                       }

                   }
               }
           }

           ProjectShortCode = ProjectShortCode.toUpperCase();
           alert(ProjectShortCode);
       }
  • 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-14T14:39:44+00:00Added an answer on June 14, 2026 at 2:39 pm

    i have modified your function slightly that may help you

     function EnterShortCode() {
         var ProjectShortCode = "";
               var Arr = rtrim($("#txtProjectTitle").val()).split(" ");
        if (Arr.length>2)
        {        
        for (i = 0; i < Arr.length; i++) {
                   if (Arr[i] != "" && Arr[i] != null) {
                       ProjectShortCode += Arr[i].substring(0, 1);
                       if (i == Arr.length - 1) {
                           if (ProjectShortCode.length == 1) {
                               if (Arr[i] < 3) {
    
                               }
                               else {
                                   ProjectShortCode = ProjectShortCode + Arr[i].substring(1, 3);
                               }
                           }
                           else if (ProjectShortCode.length == 2) {
                               if (Arr[i] < 2) {
    
                               }
                               else {
                                   ProjectShortCode = ProjectShortCode + Arr[i].substring(1, 2)
                               }
    
                           }
    
                       }
                   }
               }
             }
           else
           {
              for (i = 0; i < Arr.length; i++) {
                   if (Arr[i] != "" && Arr[i] != null) {
                                 if(i==0 && Arr.length==2)
                  {              
                     ProjectShortCode += Arr[i].substring(0, 2);
                  }
                               else if(i==0 && Arr.length==1)
                               {
                                   ProjectShortCode += Arr[i].substring(0, 3);
                               }
                  else
                  {
                         ProjectShortCode += Arr[i].substring(0, 1);
                  }   
    
                       if (i == Arr.length) {
                           if (ProjectShortCode.length == 1) {
                               if (Arr[i] < 3) {
    
                               }
                               else {
                                   ProjectShortCode = ProjectShortCode + Arr[i].substring(1, 3);
                               }
                           }
                           else if (ProjectShortCode.length == 2) {
                               if (Arr[i] < 2) {
    
                               }
                               else {
                                   ProjectShortCode = ProjectShortCode + Arr[i].substring(1, 2)
                               }
    
                           }
    
                       }
                   }
               }                         
           }
               ProjectShortCode = ProjectShortCode.toUpperCase();
               alert(ProjectShortCode);
        }
    

    LIVE DEMO

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

Sidebar

Related Questions

I need help on concatenation. I have a Title which is displayed below like
I would like to make every EditText object have own title like in Pure
I want to have my title tag look like this: My Website - Name
I have this in my controller: Konkurrencer.where(title LIKE ?, %#{params[:q]}%).limit(4) I think this query
I have model like this: scope :search_posts, lambda { |query| mega_posts.where( title LIKE ?
have such zend query: $select = $this->_table ->select() ->where('title LIKE ?', '%'.$searchWord.'%') ->where('description LIKE
I would like to have a title element with overflow-x:hidden and overflow-y:visible . However,
I have a text like: Title A some description on a few lines, there
I have a question regarding building GUI applications. I feel like the title of
I have SELECT * FROM hnurl WHERE title LIKE('%text1%') How do I extend this

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.