current position:Home>A=“abc123”'B=“EDF456”

A=“abc123”'B=“EDF456”

2022-02-02 21:27:56 CSDN Q & A

subject A=“abc123”'B=“EDF456”
requirement :
1: Connect two strings , And assign the result to H, The result is H="abc123EDF456"
2: lookup H In a string F The location of , Output the position
3: hold E Replace with N
4: Intercept out DNF

( wed The front-end development )




Refer to the answer 1:
  1. H=A+B
  2. var i =H.indexOf('F')
  3. H.replace(/E/,"N")
  4. var i H.indexOf("DNF")
    H.substr(i,3)

If help , Excuse me [ Adopt this answer ]




Refer to the answer 2:



Refer to the answer 3:

Based on the question , Give advice
let a = 'abc123', b = 'EDF456', H, fIndex;

  1. H = a + b; // Connect two strings , And assign the result to H, The result is H="abc123EDF456"
  2. fIndex = H.indexOf('F'); // lookup H In a string F The location of , Output the position
  3. newH = H.replace(/\E/g, 'N'); // hold E Replace with N
  4. ndf = H.slice(6, 9); // Intercept out DNF

If help Hope you like it




Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022127548719.html

Random recommended