Friday, March 24, 2023
Learning Code
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
Learning Code
No Result
View All Result
Home JavaScript

How can I remove text from a strReviewers string using JavaScript or jQuery? – JavaScript – SitePoint Forums

learningcode_x1mckf by learningcode_x1mckf
November 23, 2022
in JavaScript
0
Time limit for notify – JavaScript – SitePoint Forums
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


You might also like

Toolkit Allows JavaScript Devs to Program Embedded Devices – The New Stack

Select data value from grandparent div? – JavaScript – SitePoint

How to Handle Errors in JavaScript – Programming – MUO – MakeUseOf

How can I take away textual content(e.g [“88664734”,“88639280”,“88676217”]) from a strReviewers string which comprises record of Reviewers separated by semicolon after which be part of the entire string once more both utilizing JavaScript or jQuery?

I get a dynamic string(strReviewers) which comprises a number of person data separated by comma:

I must take away entire person report if I go an array of ids. e.g [“88664734”,“88639280”,“88676217”]

var strReviewers = "88664734*,*Andrew Farmer*,*19042*,**,*,19013,19017,19042,19043,19051,*;*88639280*,*Sally Hopewell*,*19042*,**,*,19013,19017,19042,19043,*;*88686221*,*Jonathan Rees*,*19042*,**,*,19013,19017,19042,19043,19060,*;*88676217*,*James Wason*,*19042*,**,*,19013,19017,19042,19043,*;*";

strReviewers comprises person data separated by semicolon and every person report is separated by ,.

Every report comprises 1 person which is within the form of userid then following by identify then following by roleid then following by txtSpeciality following by then rolelist.

sort or paste code right here
/*
88664734*,*Andrew Farmer*,*19042*,**,*,19013,19017,19042,19043,19051,*;
*88639280*,*Sally Hopewell*,*19042*,**,*,19013,19017,19042,19043,*;
*88686221*,*Jonathan Rees*,*19042*,**,*,19013,19017,19042,19043,19060,*;
*88676217*,*James Wason*,*19042*,**,*,19013,19017,19042,19043,*;
*/

I've finished it utilizing the next code however questioning this may be achieved another simpler manner?
perform removeReviewerByID(ids = []) 
   return strReviewers
        .cut up(";")
        .map(merchandise => merchandise.cut up("*,*"))      
        .filter(merchandise => merchandise[0] !== "*")
        .map(merchandise => (
          userid:merchandise[0],
          identify:merchandise[1],
          roleid:merchandise[2],
          txtSpeciality:merchandise[3],
          rolelist:merchandise[4]
        ))        
        .filter(merchandise => (!ids.consists of(merchandise["userid"]) && !ids.consists of(merchandise["userid"].substitute(/*/g, ''))))
        .map(merchandise => (
          report: merchandise["userid"].concat("*,*").concat(merchandise["name"]).concat("*,*").concat(merchandise["roleid"]).concat("*,*").concat(merchandise["txtSpeciality"]).concat("*,*").concat(merchandise["rolelist"]).concat(";")
        ))
        .cut back((accumulator, merchandise) =>   
          return accumulator.concat(merchandise["record"]);
        , "")        


console.log(removeReviewerByID(["88664734","88639280","88676217"]));



Source link

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

Toolkit Allows JavaScript Devs to Program Embedded Devices – The New Stack

by learningcode_x1mckf
March 23, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Toolkit Allows JavaScript Devs to Program Embedded Devices  The New Stack Source link

Read more

Select data value from grandparent div? – JavaScript – SitePoint

by learningcode_x1mckf
March 23, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Select data value from grandparent div? - JavaScript  SitePoint Source link

Read more

How to Handle Errors in JavaScript – Programming – MUO – MakeUseOf

by learningcode_x1mckf
March 23, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

How to Handle Errors in JavaScript - Programming  MUO - MakeUseOf Source link

Read more

How to Use the Javascript Slice Method – hackernoon.com

by learningcode_x1mckf
March 23, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

How to Use the Javascript Slice Method  hackernoon.com Source link

Read more

Clean Code in JavaScript – SitePoint

by learningcode_x1mckf
March 23, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Clean Code in JavaScript  SitePoint Source link

Read more
Next Post
Extent-Local Variables to Promote Immutability in Java

Extent-Local Variables to Promote Immutability in Java

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

How to use JShell in Java – TheServerSide.com

February 27, 2023
Data visualization with Observable JavaScript

Data visualization with Observable JavaScript

October 7, 2022
Facebook MemLab Helps Finding JavaScript Memory Leaks

Facebook MemLab Helps Finding JavaScript Memory Leaks

September 13, 2022

Browse by Category

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

RECENT POSTS

  • Java Developer Survey Reveals Increased Need for Java … – PR Newswire
  • What You Should Definitely Pay Attention to When Hiring Java Developers – Modern Diplomacy
  • Java Web Frameworks Software Market Research Report 2023 … – Los Alamos Monitor

CATEGORIES

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

© 2022 Copyright Learning Code

No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#

© 2022 Copyright Learning Code

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?