Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

string substring last 3 and first character



    const String= "As you can see based on the previous"

    //if local 
    const WAFrist = String.substring(0, 9);
    const WALast = String.slice(-9);
    const FullWA = WAFrist + "..." + WALast;

    <p>{FullWA}</p>

    Result 
    As you ca...e previous

	// if data coming from api
	const WAFrist = String ? String.substring(0, 9) : "";
    const WALast = String ? String.slice(-10) : "";
    const FullWA = WAFrist + "..." + WALast;


    <p>{FullWA}</p>

    Result 
    As you ca...e previous
 
PREVIOUS NEXT
Tagged: #string #substring #character
ADD COMMENT
Topic
Name
5+5 =