question

MohammadQasim-1438 avatar image
0 Votes"
MohammadQasim-1438 asked MohammadQasim-1438 commented

How to chnage sign from particular position using jquery/Javascript ( client side )


Greetings,

Using Sharepoint 2016 on prem


i have multiple string like below

1)SPL/F390/Eng/Chm/Dis-01-00

2)SPL/F390/Prd/MQC/PED-01-00

solution Required: How can I change "/" text to "-" this text,only after 4th position of "/" sign. it means , in 1st string it comes after "Chm "and in 2nd string it comes"MQC".

My output would be like this

SPL/F390/Eng/Chm-Dis-01-00

SPL/F390/Prd/MQC-PED-01-00

Using jquery ,JavaScript

Thanks

office-sharepoint-server-development
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered MohammadQasim-1438 commented

Hi @MohammadQasim-1438,

Below is my demo for you:

 var str="SPL/F390/Eng/Chm/Dis-01-00";
 var n=str.lastIndexOf('/');
 str=str.slice(0,n)+str.slice(n).replace('/','-');


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.