export const deleteWordAt = ( str , index ) : string => { if ( index === 0 ) return str ; let start = index ; while ( str . charAt ( start - 1 ) === " " && start != 0 ) { start -- ; } while ( str . charAt ( start - 1 ) !== " " && start != 0 ) { start -- ; } if ( start === 0 ) { return str . slice ( index , str . length ) ; } return str . slice ( 0 , start ) + str . slice ( index , str . length ) ; } ; export const inserCharAt = ( str , index ) : string => { if ( index === 0 ) return str ; return str . slice ( 0 , index - 1 ) + str . slice ( index ) ; } ; export const deleteCharAt = ( str , index ) : string => { if ( index === 0 ) return str ; return str . slice ( 0 , index - 1 ) + str . slice ( index ) ; } ; export const reverse = ( str ) : string => str . split ( "" ) . reverse ( ) . join ( "" ) ;