//String.prototype.indexOf()
const result = 'Hello world'.indexOf('world');
const result2 = 'Hello world'.indexOf('wow');
console.log(result); //6
console.log(result2); //-1 //문자열없을 경우 -1
//String.length 스트링객체 문자길이 알고싶을때 사용하는 prototype
//String.slice(x번째부터,y-1까지추출) : 추출의 개념 !!
//**비교String.splice()
//String.replace(a,b) a를 찾아서 b로 교체
const str = 'hello world';
console.log(str.replace('world','mag'));//hello mag
console.log(str.replace('world','')); //응용 //hello
//String.match(정규표현식)
//특정문자데이터에서 정규표현식을활용하여 원하는 부분을 배열형태로 추출
const str2 = 'abce@gmail.com';
console.log(str2.match(/.+(?=@)/)[0]);//abcd
//String.trim 공백문자 제거
//아이디 등 입력할때 사용자들이 공백을 넣는 경우에 많이 활용
const str3 = ' Hello Wolrd';
console.log(str3.trim());//Hello World