URLify algorithm

preview_player
Показать описание
write a method to replace all spaces in a string with "%20".
Input: URLify(“Mr John Smith ”, 13)

Subscribe here for more videos:
Рекомендации по теме
Комментарии
Автор

input.replaceAll(' ', '%20')
done.

LouisT
Автор

// Urlify
// we need to replace whitespaces wid %20

const isUrlify = (str, no)=>{

// console.log(str)
let newstr = str.trim()
// console.log(newstr)

let result = newstr.replace(/ /g, '%20') //this is global we can use this to replace all the places that we want to with the value we want
console.log(result)
}


isUrlify(" MR Jhon Smith ", 13)

abhisheksah
Автор

good job with all these algo videos... good review...keep them coming babacademy

devapp
Автор

broo im impressed what a solution thankss

manansarraf
Автор

function urlify(str1) {
return str1.trim().replaceAll(' ', '%20')
}

zeyadmoamen
Автор

const text = 'My name is hanzel ';
const characters = 17;
const deletedFinalSpaces = text.substr(0, characters);
const result = ', '%20');
console.log('result:', result)

HaHaHanzel
Автор

const urlFillup=((str, replaceWith)=>{
regex = /\s/g
return str.replaceAll(regex, replaceWith)
})
urlFillup('My name is ojha', '%2000')

adarshojha
visit shbcf.ru